微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

根据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的客户端?一直报异常,求助,谢谢!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐