根據wsdl文件使用xfire生成webservice客戶端

在Myeclipse中根據a.wsdl文件用xfire可以生產客戶端,用b.wsdl生成報異常,異常如下:

驗證了b.wsdl文件,是正確的

其中b.wsdl文件內容如下:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="sobey.com.AutoNetService/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="sobey.com.AutoNetService/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="sobey.com.AutoNetService/">
       <s:element name="GetNewData">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="sUserID" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="sIP" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="sDetail" type="s:string" />
            <s:element minOccurs="1" maxOccurs="1" name="bRefresh" type="s:boolean" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="GetNewDataResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="GetNewDataResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>

  <wsdl:message name="GetNewDataSoapIn">
    <wsdl:part name="parameters" element="tns:GetNewData" />
  </wsdl:message>
  <wsdl:message name="GetNewDataSoapOut">
    <wsdl:part name="parameters" element="tns:GetNewDataResponse" />
  </wsdl:message>
 
  <wsdl:portType name="DataAccessSoap">
    <wsdl:operation name="GetNewData">
      <wsdl:input message="tns:GetNewDataSoapIn" />
      <wsdl:output message="tns:GetNewDataSoapOut" />
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="DataAccessSoap" type="tns:DataAccessSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
    <wsdl:operation name="GetNewData">
      <soap:operation soapAction="sobey.com.AutoNetService/GetNewData" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="DataAccess">
    <wsdl:port name="DataAccessSoap" binding="tns:DataAccessSoap">
     <soap:address location="http://172.16.163.22/AutoNetService/DataAccess.asmx" />
    </wsdl:port>
  </wsdl:service>

</wsdl:definitions> 

怎樣使用這個b.wsdl文件生成對應的客戶端呢?

使用a.wsdl可以生成webservice客戶端,步驟如下:

第一步

第二步

第三

第四步

點擊finish就可以看到工程下的客戶端了,如下圖所示:

 

a.wsdl文件內容如下:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://JetsenNet/JNMP/"
xmlns:ns1="http://net.jetsennet"
xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding"
xmlns:tns="http://JetsenNet/JNMP/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">

  <wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://JetsenNet/JNMP/">
<xsd:element name="bmptest">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="objType" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="objIds" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="bmptestResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
  </wsdl:types>

  <wsdl:message name="bmptestRequest">
    <wsdl:part name="parameters" element="tns:bmptest">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="bmptestResponse">
    <wsdl:part name="parameters" element="tns:bmptestResponse">
    </wsdl:part>
  </wsdl:message>

  <wsdl:portType name="CATVSystemService">
      <wsdl:operation name="bmptest">
      <wsdl:input name="bmptestRequest" message="tns:bmptestRequest">
    </wsdl:input>
      <wsdl:output name="bmptestResponse" message="tns:bmptestResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="CATVSystemServiceHttpBinding" type="tns:CATVSystemService">
    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="bmptest">
      <wsdlsoap:operation soapAction=""/>
      <wsdl:input name="bmptestRequest">
        <wsdlsoap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="bmptestResponse">
        <wsdlsoap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="CATVSystemService">
    <wsdl:port name="CATVSystemServiceHttpPort" binding="tns:CATVSystemServiceHttpBinding">
      <wsdlsoap:address location="http://192.168.8.160:8080/jnmp_catv/services/CATVSystemService"/>
    </wsdl:port>
  </wsdl:service>

</wsdl:definitions>

 

最後在問一下,使用b.wsdl文件如何才能生成webservice的客戶端?一直報異常,求助,謝謝!

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章