java wsimport字符串

时间:2012-02-20 14:03:31

标签: java class wsimport

我在尝试生成一些Java类时遇到了问题。

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,也没能在网上找到任何类似的问题。这是拼写问题吗?

1 个答案:

答案 0 :(得分:1)

我认为WSDL是错误的。

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

所以xsd:string不正确,它应该是你之前定义的某种类型。

将其与此处的一些示例进行比较: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