获取属性已从wsimport定义错误

时间:2017-07-14 12:16:16

标签: java xml jaxb wsdl wsimport

我从stackoverflow看了类似的解决方案,但我无法处理它。 它说:[错误]属性“任何”已经定义。使用< jaxb:property>解决这个冲突。我创建了一个绑定xml来解决冲突并尝试重命名“Any”属性,它说你的XPath是不正确的。但我无法找到路径中的错误。为了更好地解释,共享“wsdl”,我无法对其进行任何更改,其外部服务。我的绑定xml。

Wsdl:

<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri_integration.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri_integration.org/">
    <wsdl:types>
        <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri_integration.org/">
            .
            .
            .
            <s:element name="Get_DataSet_Data_With_IDResponse">
                <s:complexType>
                    <s:sequence>
                        <s:element minOccurs="0" maxOccurs="1" name="Get_DataSet_Data_With_IDResult">
                            <s:complexType>
                                <s:sequence>
                                    <s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax"/>
                                    <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax"/>
                                </s:sequence>
                            </s:complexType>
                        </s:element>
                        <s:element minOccurs="0" maxOccurs="1" name="pref_err" type="s:string"/>
                    </s:sequence>
                </s:complexType>
            </s:element>
        </s:schema>
    </wsdl:types>
</wsdl:definitions>

绑定xml:

<jxb:bindings xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
              xmlns="http://java.sun.com/xml/ns/jaxws"
              xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
              xmlns:s="http://www.w3.org/2001/XMLSchema"
              wsdlLocation="http://10.10.10.10:8080/integration.asmx?wsdl">

    <jxb:bindings
            node="/wsdl:definitions/wsdl:types/s:schema/s:element[@name='Get_DataSet_Data_With_IDResponse']/s:complexType/s:sequence/s:element[@name='Get_DataSet_Data_With_IDResult']/s:complexType/s:sequence/s:any[@namespace='urn:schemas-microsoft-com:xml-diffgram-v1']/s:complexType">
        <jxb:property name="any2"/>
    </jxb:bindings>
</jxb:bindings>

这样的cmd命令:

wsimport -clientjar export.jar -b binding.xml http://10.10.10.10:8080/integration.asmx?wsdl

1 个答案:

答案 0 :(得分:0)

最后,明白了,解决了我的问题。

我忘记了schemaLocation。这也是我的财产的错误路径。

我的绑定xml:

<jxb:bindings version="2.0" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
              xmlns="http://java.sun.com/xml/ns/jaxws"
              xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
              xmlns:s="http://www.w3.org/2001/XMLSchema"
>
    <jxb:bindings schemaLocation="http://10.10.10.10:8080/integration.asmx?wsdl#types?schema1"
                  node="//s:element[@name='Get_DataSet_Data_With_IDResponse']/s:complexType/s:sequence/s:element[@name='Get_DataSet_Data_With_IDResult']/s:complexType/s:sequence/s:any[@namespace='urn:schemas-microsoft-com:xml-diffgram-v1']">
        <jxb:property name="any2"/>
    </jxb:bindings>
</jxb:bindings>