Details on WSDL bindings

与世无争的帅哥 提交于 2019-12-23 02:36:30

问题


I am learning WSDL from online documentation, there it is mentioned that:

A binding MUST specify exactly one protocol.

A binding MUST NOT specify address information.

and sample example given is:

<binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="GetLastTradePrice">
           <soap:operation soapAction="http://example.com/GetLastTradePrice"/>
           <input>
               <soap:body use="literal"/>
           </input>
           <output>
               <soap:body use="literal"/>
           </output>
        </operation>
    </binding>

What it means a protocol and how is this mapped in this example? Also what address the WSDL must not specify?


回答1:


So SOAP is a xml message that you send across the network. There are various way that you can send this SOAP message across the network. This mechanism is called the transport protocol.

Traditionally you would use HTTP as the transport protocol however there is nothing stopping you from sending a SOAP message over JMS(Java Message Queue) , SMTP (Simple Mail Transfer Protocol) or even a plain socket.

Essentially when you define the protocol in the WSDL it is saying I will send this message using the protocol defined in the WSDL. In your example the WSDL clearly states it will use the HTTP protocol this section here contains the information: transport="http://schemas.xmlsoap.org/soap/http"

This Wikipedia Entry on SOAP has a transport section that carries more detail.

The binding deals with how the XML is transported over the network and which style it will be using. There are various styles of sending SOAP messages such as document, literal and RPC. This is all got to do with how not where. The service and port elements in the WSDL deals with where I can find the service etc. So that is why you dont specify the web service address in the binding section but in the port and service section.

It would be good to read up about the different styles as well. See this article to get a insight into RPC,Literal and Document terminology.



来源:https://stackoverflow.com/questions/20891073/details-on-wsdl-bindings

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!