当前位置: 代码迷 >> Web Service >> 请问怎么解析 .svc?wsdl 服务描述? 用java1客户端怎么调用接口
  详细解决方案

请问怎么解析 .svc?wsdl 服务描述? 用java1客户端怎么调用接口

热度:720   发布时间:2012-12-27 10:17:10.0
请教如何解析 .svc?wsdl 服务描述? 用java1客户端如何调用接口
本帖最后由 viviandew 于 2012-11-22 10:43:17 编辑 http://ip:port/CarBar.svc?wsdl 如下:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" 
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" 
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" 
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:tns="http://tempuri.org/" 
xmlns:wsa10="http://www.w3.org/2005/08/addressing" 
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
targetNamespace="http://tempuri.org/" name="CarBar">

<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import namespace="http://tempuri.org/" schemaLocation="http://ip:port/CarBar.svc?xsd=xsd0"/>
<xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" schemaLocation="http://ip:port/CarBar.svc?xsd=xsd1"/>
<xsd:import namespace="http://schemas.datacontract.org/2004/07/Easyway.Interfaces.Publish.Entities" schemaLocation="http://ip:port/CarBar.svc?xsd=xsd2"/>
<xsd:import namespace="http://schemas.datacontract.org/2004/07/System.Data.Objects.DataClasses" schemaLocation="http://ip:port/CarBar.svc?xsd=xsd3"/>
<xsd:import namespace="http://schemas.datacontract.org/2004/07/System.Data" schemaLocation="http://ip:port/CarBar.svc?xsd=xsd4"/>
</xsd:schema>
</wsdl:types>

<wsdl:message name="ICarBar_GetCar_InputMessage">
<wsdl:part name="parameters" element="tns:GetCar"/>
</wsdl:message>
<wsdl:message name="ICarBar_GetCar_OutputMessage">
<wsdl:part name="parameters" element="tns:GetCarResponse"/>
</wsdl:message>

<wsdl:portType name="ICarBar">
<wsdl:operation name="GetCar">
<wsdl:input message="tns:ICarBar_GetCar_InputMessage" wsaw:Action="http://tempuri.org/ICarBar/GetCar"/>
<wsdl:output message="tns:ICarBar_GetCar_OutputMessage" wsaw:Action="http://tempuri.org/ICarBar/GetCarResponse"/>
</wsdl:operation>
</wsdl:portType>

<wsdl:binding name="Carhttpwcf" type="tns:ICarBar">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetCar">
<soap:operation style="document" soapAction="http://tempuri.org/ICarBar/GetCar"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<wsdl:service name="CarBar">
<wsdl:port name="Carhttpwcf" binding="tns:Carhttpwcf">
<soap:address location="http://ip:port/CarBar.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>




我用了axis 的两种方法:一种是直接远程该服务:

String urlname = "http://ip:port/CarBar.svc?wsdl" ; 
  相关解决方案