2012-02-20 56 views
1

我在尝试生成一些Java类时遇到了问题。java wsimport字符串

C:\Users\kon\Desktop>wsimport -keep -verbose -extension -d generated http://XXXXXXWebServicesPort?wsdl 
parsing WSDL... 

[INFO] Trying to read authorization file : "C:\Users\kon\.metro\auth"... 

[ERROR] Schema descriptor {http://www.w3.org/2001/XMLSchema}string in message part "return" is not defined and could not be bound to Java. Perhaps the schema descriptor {http://www.w3.org/2001/XMLSche 
ma}string is not defined in the schema imported/included in the WSDL. You can either add such imports/includes or run wsimport and provide the schema location using -b switch. 
    line 81 of http://XXXXXXWebServicesPort?wsdl 

这里的含量在81行:

<message name="getJDBCConnectionURLOutput"> 
    <part name="return" element="xsd:string"/> 
</message> 

我以前没有使用过的wsimport,无法在网络上找到任何类似的问题。这是拼写问题吗?

+0

你确定你没有之间的任何控制字符“:”和的'xsd:string @ 81?' – 2012-02-20 14:11:43

+0

我用WireShark检查了这个,但它的接缝是正确的:[链接](http://img217.imageshack.us/img217/5594/stringh.png) – kon 2012-02-20 14:58:01

+0

你有没有读过我的答案? – davidfrancis 2012-02-21 08:41:52

回答

1

我认为WSDL是错误的。

它认为你指向一个名为xsd:string的元素,它在之前的WSDL中定义。

因此,xsd:字符串不正确,它应该是您之前定义的某种类型。

比较它这里的一些例子:http://www.w3.org/2001/03/14-annotated-WSDL-examples

HTH

编辑:你不能把它定义为字符串类型那样直接。 也许你的意思是这样的:

<part name="return" type="xsd:string"/> 

编辑:也许在WSDL规范这个信息将帮助: http://www.w3.org/TR/wsdl#_soap:body

+0

嗨@davidfrancis,谢谢你的帮助。 xsd:字符串在xmlns:xsd =“http://www.w3.org/2001/XMLSchema”中定义。我的同事告诉我,某个解析器有一个字符串问题。最新版本的轴应该是正确的。我可以找到这个声明的任何错误报告。 – kon 2012-02-23 00:59:27

+0

看我的编辑到我的答案 – davidfrancis 2012-02-23 16:26:03

+0

也许这就是你要找的? – davidfrancis 2012-02-23 16:26:12