课程表

WSDL课程

工具箱
速查手册

WSDL 绑定

当前位置:免费教程 » XML相关 » WSDL

WSDL 绑定可为 web service 定义消息格式和协议细节。

绑定到 SOAP

一个 请求 - 响应 操作的例子:

  1. <message name="getTermRequest">
  2. <part name="term" type="xs:string" />
  3. </message>
  4.  
  5. <message name="getTermResponse">
  6. <part name="value" type="xs:string" />
  7. </message>
  8.  
  9. <portType name="glossaryTerms">
  10. <operation name="getTerm">
  11. <input message="getTermRequest" />
  12. <output message="getTermResponse" />
  13. </operation>
  14. </portType>
  15.  
  16. <binding type="glossaryTerms" name="b1">
  17. <soap:binding style="document"
  18. transport="http://schemas.xmlsoap.org/soap/http" />
  19. <operation>
  20. <soap:operation
  21. soapAction="http://example.com/getTerm" />
  22. <input>
  23. <soap:body use="literal" />
  24. </input>
  25. <output>
  26. <soap:body use="literal" />
  27. </output>
  28. </operation>
  29. </binding>

binding 元素有两个属性 - name 属性和 type 属性。

name 属性定义 binding 的名称,而 type 属性指向用于 binding 的端口,在这个例子中是 "glossaryTerms" 端口。

soap:binding 元素有两个属性 - style 属性和 transport 属性。

style 属性可取值 "rpc" 或 "document"。在这个例子中我们使用 document。transport 属性定义了要使用的 SOAP 协议。在这个例子中我们使用 HTTP。

operation 元素定义了每个端口提供的操作符。

对于每个操作,相应的 SOAP 行为都需要被定义。同时您必须如何对输入和输出进行编码。在这个例子中我们使用了 "literal"。

转载本站内容时,请务必注明来自W3xue,违者必究。
 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号