WSDL学习笔记
来源:互联网 发布:搜索网站软件 编辑:程序博客网 时间:2024/05/20 18:45
WSDL学习笔记
一.学习资料参考
http://www.w3school.com.cn/wsdl/index.asp
二.WSDL的定义
WSDL(WebServices Description Language)全名为网络服务描述语言,他是W3C组织于2002年7月发布的一项用于描述web服务的文档,此文档用XML语言编写,体现其跨平台性。其文档主要描述了web服务所提供的操作(或方法)。
三.WSDL的文档结构:
WSDL用以下元素来描述某个webservice:
元素
定义
<portType>
Web service执行的操作
<message>
Web service使用的消息
<types>
Web service 使用的数据类型
<binding>
Web service使用的协议
文档格式如下:
<definitions>
<types>
definition of types........
</types>
<message>
definition of a message....
</message>
<portType>
definition of a port.......
</portType>
<binding>
definition of a binding....
</binding>
</definitions>
WSDL还包含其他元素比如extension元素,此元素可把若干个webservice的定义组合在一个单一的WSDL文档中。
<porttype>:WSDL端口
Porttype相当于编程里面的函数库(或一个模块、或一个类)。
<message>:WSDL 消息元素定义一个操作的数据元素。
每个消息均有一个或多个部件组成,可以吧消息比作编程语言中函数调用的参数。
<types> 定义元素的数据类型,为了最大程度的平台中立性,WSDL使用XML schema语法来定义数据类型。
<binding> 元素为每个端口定义消息格式和协议细节。
四.WSDL文档的请求--响应操作
在WSDL中支持4中不同类型的响应方式,分别为
类型
定义
One-way
此操作可接受一个消息,但不会返回响应
Requesrt-Respose
此操作可以接受一个请求,并返回一个响应
Solicit-responses
发送一个消息,并且等待响应
Notification
发送一个请求,单不会等待响应
One-way的实现
<message name=”newTermValues”>
<part name=”term” type=”xs:string”/>
<part name=”value” type=”xs:string”/>
</message>
<portType name=”glossaryTerms”>
<operationname=”setTerm”>
<inputname=”newTerm” message=”newTermValues”/>
</operation>
</portType>
Request-Respose的实现:
<message name=”newTermValues”>
<partname=”requestParamter” type=”sx:string”>
</message>
<message name=”newTermValues”>
<partname=” reposeParamter” type=”sx:string”>
</message>
<portType name=”glossaryTerms”>
<operationname=”setTerm”>
<inputmessage=” requestParameter”/>
<output messge=”resposeParameter”/>
</operation>
</porType>
五.绑定SOAP协议
绑定到 SOAP
一个 请求 - 响应 操作的例子:
<message name="getTermRequest">
<partname="term" type="xs:string" />
</message>
<message name="getTermResponse">
<partname="value" type="xs:string" />
</message>
<portType name="glossaryTerms">
<operationname="getTerm">
<inputmessage="getTermRequest" />
<outputmessage="getTermResponse" />
</operation>
</portType>
<binding type="glossaryTerms" name="b1">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation>
<soap:operation
soapAction="http://example.com/getTerm" />
<input>
<soap:bodyuse="literal" />
</input>
<output>
<soap:bodyuse="literal" />
</output>
</operation>
</binding>
binding 元素有两个属性 - name 属性和 type 属性。
name 属性定义 binding 的名称,而 type 属性指向用于 binding 的端口,在这个例子中是"glossaryTerms" 端口。
soap:binding 元素有两个属性 - style 属性和transport 属性。
style 属性可取值 "rpc" 或"document"。在这个例子中我们使用document。transport 属性定义了要使用的 SOAP 协议。在这个例子中我们使用 HTTP。
operation 元素定义了每个端口提供的操作符。
对于每个操作,相应的 SOAP 行为都需要被定义。同时您必须如何对输入和输出进行编码。在这个例子中我们使用了"literal"。
六:UDDI和WSDL
UDDI是一种目录服务,企业可以使用它对Web services进行注册和搜索。
UDDI英文为“UniversalDescription,Discovery and Integration”翻译为通用描述、发现与集成服务。
UDDI 规范帮助我们解决的问题:
1. 能利用inerter网在数以百计的web service服务中得到你想要的那个服务。
2. 一旦找到你期望那个服务后,可以使用服务当中具体的内容。
3. 使用UDDI可以扩展web service服务,能获取更多的使用者。
4. 使用UDDI可以更好整合各个系统,可以进行更统一的维护和管理。
七:WSDL语法
<wsdl:definitions name="nmtoken"?targetNamespace="uri">
<importnamespace="uri" location="uri"/> *
<wsdl:documentation .... /> ?
<wsdl:types> ?
<wsdl:documentation .... /> ?
<xsd:schema .... /> *
</wsdl:types>
<wsdl:message name="ncname"> *
<wsdl:documentation .... /> ?
<partname="ncname" element="qname"? type="qname"?/>*
</wsdl:message>
<wsdl:portType name="ncname"> *
<wsdl:documentation .... /> ?
<wsdl:operation name="ncname"> *
<wsdl:documentation .... /> ?
<wsdl:input message="qname"> ?
<wsdl:documentation .... /> ?
</wsdl:input>
<wsdl:output message="qname"> ?
<wsdl:documentation .... /> ?
</wsdl:output>
<wsdl:fault name="ncname" message="qname"> *
<wsdl:documentation .... /> ?
</wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:serviceType name="ncname"> *
<wsdl:portType name="qname"/> +
</wsdl:serviceType>
<wsdl:binding name="ncname" type="qname"> *
<wsdl:documentation .... /> ?
<--binding details --> *
<wsdl:operation name="ncname"> *
<wsdl:documentation .... /> ?
<--binding details --> *
<wsdl:input> ?
<wsdl:documentation .... /> ?
<-- binding details -->
</wsdl:input>
<wsdl:output> ?
<wsdl:documentation .... /> ?
<-- binding details --> *
</wsdl:output>
<wsdl:fault name="ncname"> *
<wsdl:documentation .... /> ?
<-- binding details --> *
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ncname"serviceType="qname"> *
<wsdl:documentation .... /> ?
<wsdl:port name="ncname" binding="qname"> *
<wsdl:documentation .... /> ?
<-- address details -->
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
- WSDL学习笔记
- WSDL学习笔记
- WSDL学习笔记-01
- WSDL学习笔记
- WSDL学习笔记(一)
- WebService学习笔记之WSDL
- WebService学习笔记-WSDL文档分析
- webservice学习笔记(5)--WSDL文档
- WSDL笔记
- WSDL学习
- WSDL学习
- wsdl 学习
- wsdl学习
- wsdl学习
- WSDL学习
- c# Web Services学习笔记(六、WSDL概述)
- c# Web Services学习笔记(七、WSDL文档的结构)
- 【转帖】XML Schema学习笔记详解WSDL types
- 简述configure、pkg-config、pkg_config_path三者的关系
- 监测服务器性能方法-事件日志
- OFDM& OFDMA
- count logs from 10.09 to 10.10
- qemu&kgdb [1]
- WSDL学习笔记
- 几种开源的TCP/IP协议栈分析
- SSH
- Linux内核模块编译指南
- Gstreamer说明
- ajax中文乱码和相对路径
- Oracle 10g忘记system,sys密码的解决办法
- 802.11无线网络概述2
- 中国平安到底是否要卖掉?