Open In App

WSDL <binding> Element

WSDL <binding> Element is used to provide details on how a portType operation will actually be transmitted over the wire. It can be delivered using a variety of protocols, such as HTTP GET, HTTP POST, or SOAP. For the SOAP protocol, the transport is SOAP messages on top of the HTTP protocol, and the binding is <soap:binding>.

Syntax:



<binding name="Greetings_Binding" type="tns:Greetings_PortType">
<!-- SOAP Binding and related elements go here -->
</binding>

SOAP Binding: Built-in SOAP 1.1 extensions are available in WSDL 1.1. It enables you to specify SOAP-specific information, such as HTTP SOAPAction headers, SOAP encoding styles, and SOAP headers for headers. The following are some examples of the SOAP extension elements.

The below examples illustrate the WSDL <binding> Element:



Example 1:




<binding name = "Greeting_Binding" type = "tns:Greeting_PortType">
   <soap:binding style = "rpc" transport = "..."/>
   <operation name = "Greeting">
      <soap:operation soapAction = "Greeting"/>
             
      <input>
         <soap:body encodingStyle = "..." namespace = "urn:examples:Greeting" use = "encoded"/>
      </input>   
      <output>
         <soap:body
            encodingStyle = "..."
            namespace = "urn:examples:Greeting" use = "encoded"/>
      </output>
   </operation>
</binding>

In this example, we have defined a binding named “Greeting_Binding” for the “Greeting_PortType” with SOAP-based settings for the “Greeting” operation.

Example 2:




<binding name = "Greeting_Binding" type = "tns:Greeting_PortType">
   <soap:binding style = "rpc" transport = "..."/>
   <operation name = "Greeting">
      <soap:operation soapAction = "Greeting"/>
             
      <input>
         <soap:body
            encodingStyle = "..."
            namespace = "urn:examples:Greeting" use = "encoded"/>
      </input>
             
      <output>
         <soap:body
            encodingStyle = "..."
            namespace = "urn:examples:Greeting" use = "encoded"/>
      </output>
   
      <input>
         <soap:body
            encodingStyle = "..."
            namespace = "urn:examples:Bye" use = "encoded"/>
      </input>
             
      <output>
         <soap:body
            encodingStyle = "..."
            namespace = "urn:examples:Bye" use = "encoded"/>
      </output>
   </operation>
</binding>

In this second example, we have expanded upon the previous one by including additional input and output elements within the “Greeting” operation.

In conclusion, the WSDL `<binding>` element is essential for configuring how portType operations are transmitted, especially in context of SOAP-based services.


Article Tags :