已定义获取属性wsimport出错

xt0899hw  于 2021-07-09  发布在  Java
关注(0)|答案(1)|浏览(324)

我从stackoverflow中找到了类似的解决方案,但我无法处理它。它说:[错误]属性“any”已经定义。使用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>

命令如下:

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

mwkjh3gx1#

终于,明白了重点,解决了我的问题。
我忘了计划。而且这条路对我的财产来说是错误的。
这是我的绑定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>

相关问题