Binding SOAP to WSDL

SOAP messages need to be bound to a WSDL document by including the soap:binding element within the WSDL binding element.

  • The soap:binding element takes two attributes, transport and style.
  • The syntax to include the soap:binding element within the WSDL binding element is:

<binding name="BindingName" type="InterfaceName">
<soap:binding transport= "http://schemas.xmlsoap.org/soap/http"
style="rpc|document"/>
...
</binding>

where the transport attribute indicates the transport protocol, such as HTTP or SMTP, and the style attribute specifies the format of the message.

In the code snippet, http://schemas.xmlsoap.org/soap/http indicates that the transport protocol is HTTP and the format of the message is RPC.

<definitions name="SchoolLibrary"
targetNamespace="http://www.school.com/Library.wsdl">
<xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  
  <message name="getBookRequest">
    <part name="Title" type="xsd:string"/>
  </message>

  <message name="getBookResponse">
    <part name="return" type="xsd:string"/> 
  </message>
 
  <interface name=”LibInterface”>
    <operation name="getBook">
      <input message="getBookRequest"/>
      <output message="getBookResponse"/>
    </operation>
  </interface>

  <binding name="LibBinding" type="LibInterface">
    <operation name="getBook">
      <input message="lib:getBookRequest"/>
      <output message="lib:getBookResponse"/>
    </operation>
  </binding>
  <binding name="LibBinding" type="LibInterface">
    <soap:binding
    transport="http://schemas.xmlsoap.org/soap/http"
    style="rpc"/>
    <operation name="getBook">
    <soap:operation soapAction="getBook"/>
    <input>
    <soap:body encodingStyle=
    "http://schemas.xmlsoap.org/soap/enoding/"
    use="encoded"/>
    </input>
    <output>
    <soap:body encodingStyle=
    "http://schemas.xmlsoap.org/soap/encoding/"
    use="encoded"/>
    </output>
    </operation>
</binding>
<definitions
>

Click the Next button to continue.