2017-07-14 50 views
-1

我看起來類似的解決方案從stackoverflow但我無法處理它。 它說:[錯誤]屬性「任何」已被定義。使用< jaxb:property>來解決此衝突。我創建了一個綁定xml來解決衝突並嘗試重命名「Any」屬性,它表示您的XPath不正確。但我無法找到路徑中的錯誤。爲了更好地解釋,分享「wsdl」,我不能對它做任何改變,它的外部服務。也是我的綁定XML。獲取屬性已定義來自wsimport的錯誤

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 

回答

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>