WSDL学习笔记-01
什么是WSDL WSDL 指网络服务(Web Services)描述语言 (Web Services Description Language)。 总结: WSDL文档仅仅是一个简单的XML文档。它包含一系列描述某个web service的定义。 WSDL文档结构 WSDL 实例 <message name="getTermRequest"> WSDL 端口 端口定义了指向某个 web service 的连接点。可以把该元素比作传统编程语言中的一个函数库(或一个模块、或一个类),而把每个操作比作传统编程语言中的一个函数。 请求-响应是最普通的操作类型,不过 WSDL 定义了四种类型: One-way 此操作可接受消息,但不会返回响应。 WSDL 绑定 WSDL 绑定可为 web service 定义消息格式和协议细节。 一个请求 - 响应操作的例子:
<message name="getTermRequest"> <part name="term" type="xs:string" /> </message> <message name="getTermResponse"> <part name="value" type="xs:string" /> </message> <portType name="glossaryTerms"> <operation name="getTerm"> <input message="getTermRequest" /> <output message="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:body use="literal" /> </input> <output> <soap:body use="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"。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |