wsdl 1.1规范,wsdl 2.0规范,两者区别

wsdl 1.1 :
wsdl 分为抽象定义部分和具体定义部分
根为description


<definitions>
<types> ... </types>
<message> ... </message>
<portType> ... </portType>
<binding> ... </binding>
<service> ... </serivce>
</definitions>


其中,抽象定义部分为:
[b]types[/b]:相当于定义数据的具体结构,包含complex type 和simple type(就是xsd当中对数据的定义)

[b]message[/b]: 相当于每个方法的输入输出参数的定义(一个方法输入,输出各一个),message里面包含了0到多个<part>,part 相当于是具体的每个参数的定义,其中part的类型就是定义在<types>里面的。比如传入参数有两个,就相当于有一个message对应request,两个part分别对应于两个参数。

[b]portType[/b]:一组operation的集合,porttype下面定义了operation(相当于一个个的具体方法)
operation里面又定义了input 和output,input, output分别和message一一对应

摘录:
WSDL消息交换模式(MEP)
Messaging Exchange Patterns(MEP)
Web服务中使用了四种消息交换模式,即请求/响应、单向、通知以及恳求/响应模式。大多数基于WSDL的web服务使用请求/响应和单向两种模式。
WSDL通过operation元素的input/output来定义使用那种模式,如果有input+output+可选的fault参数,那就使用请求/响应模式;如果只使用input,那就使用单向模式。
在通知模式中:Web服务将消息发送给客户,但不等待回复;一般客户通过注册来接收通知;在恳求/响应模式中类似通知模式,唯一的区别要期待客户对Web服务的响应。

下面是具体定义部分
[b]bingding[/b]:将一个抽象的portType映射到一组具体的协议(SOAP或者HTTP)、消息传递样式(RPC或者document)以及编码样式(literal或者SOAP encoding)。

service:包含一到多个port,每个port是将一个binding和一个 具体地址关联

参考一个

<wsdl:definitions

targetNamespace="http://webservice.security.tempmodule.temp.com.cn"
xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding"
xmlns:tns="http://webservice.security.tempmodule.temp.com.cn"
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://webservice.security.tempmodule.temp.com.cn">
<xsd:element name="queryFunctionListByUser">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="queryFunctionListByUserResponse">
<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="queryFunctionListByUserRequest">
<wsdl:part name="parameters" element="tns:queryFunctionListByUser"/>
</wsdl:message>
<wsdl:message name="queryFunctionListByUserResponse">
<wsdl:part name="parameters" element="tns:queryFunctionListByUserResponse"/>
</wsdl:message>
<wsdl:portType name="UserFunctionWebservicePortType">
<wsdl:operation name="queryFunctionListByUser">
<wsdl:input name="queryFunctionListByUserRequest" message="tns:queryFunctionListByUserRequest"/>
<wsdl:output name="queryFunctionListByUserResponse" message="tns:queryFunctionListByUserResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="UserFunctionWebserviceHttpBinding" type="tns:UserFunctionWebservicePortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="queryFunctionListByUser">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="queryFunctionListByUserRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="queryFunctionListByUserResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="UserFunctionWebservice">
<wsdl:port name="UserFunctionWebserviceHttpPort" binding="tns:UserFunctionWebserviceHttpBinding">
<wsdlsoap:address location="http://127.0.0.1:7021/tempproject/webservice/UserFunctionWebservice"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>



wsdl2.0 和1.1的主要区别:
* 根元素为<description>,替代了1.1中的<definitions>
* 去掉了<message>元素,在定义操作时直接引用XML Schema定义的元素。
* 使用元素<interface>代替<portType>
* 引入了接口的继承,可以像面向对象一样,通过继承现有的接口来定义新的接口
* 使用元素<endpoint>代替了<port>元素
* 每个<service>只能实现一个接口,但可以包含不同的实现,即可以包含多个<endpoint>元素,分别对应不同的地址和实现。


参考资料
[url]http://blog.csdn.net/xys_777/article/details/6796966[/url]
[url]http://xiongzhenhui.iteye.com/blog/998932[/url]
[url]http://calvinliu.iteye.com/blog/1001192[/url]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值