尝试使用wsimport
为 SOAP 端点生成客户端。使用的 WSDL 和所有 XSD 文件都是本地副本。
这是正在执行的命令:
wsimport ./bwWsdl.xml -p com.generated -Xnocompile -d ../src -extension -keep -XadditionalHeaders -B-XautoNameResolution
这给出了这个错误:
[ERROR] Two declarations cause a collision in the ObjectFactory class.
line 16 of file:/schemas/newSchema.xsd
[ERROR] (Related to above error) This is the other declaration.
line 16 of file:/schemas/newSchema.xsd
请注意,报告的冲突的行号相同。
这是架构:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
version="2.004" id="OTA2003A2009A">
<xs:complexType name="TPA_ExtensionsType">
<xs:annotation>
<xs:documentation xml:lang="en">Description here.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:element name="TPA_Extensions" type="TPA_ExtensionsType">
<xs:annotation>
<xs:documentation xml:lang="en">More description here.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:schema>
我试过删除类型定义,但它在许多其他地方被引用。
任何人都可以就如何让它发挥作用提供任何建议吗?
谢谢
编辑:
以下是 WSDL 导入这些模式的行:
<definitions name='ResLookupGet' targetNamespace='http://org.jboss.ws/resLookupGet' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:http='http://schemas.xmlsoap.org/wsdl/http/' xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/' xmlns:ns='http://www.opentravel.org/OTA/2003/05/beta' xmlns:rq='http://www.opentravel.org/OTA/2003/05/betarq' xmlns:rs='http://www.opentravel.org/OTA/2003/05/betars' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://org.jboss.ws/resLookupGet' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<types>
<xsd:schema targetNamespace='http://org.jboss.ws/resLookupGet' xmlns:tns='http://org.jboss.ws/resLookupGet' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<xsd:import namespace='http://www.opentravel.org/OTA/2003/05/betarq' schemaLocation='./schemas/FooAffiliateHeaderRQ.xsd'/>
<xsd:import namespace='http://www.opentravel.org/OTA/2003/05/betarq' schemaLocation='./schemas/FooResLookupGetRQ.xsd'/>
<xsd:import namespace='http://www.opentravel.org/OTA/2003/05/betars' schemaLocation='./schemas/FooResLookupGetRS.xsd'/>
</xsd:schema>
</types>
<message name='ResLookupGetRQ'>
<part element='rq:FooResLookupGetRQ' name='FooResLookupGetRQ'></part>
</message>
<message name='ResLookupGetRS'>
<part element='rs:FooResLookupGetRS' name='FooResLookupGetRS'></part>
</message>