binding要素では、portTypeで定義したオペレーション物理モデルとしてどのように変換され使用されるかを定義します。通常は、
の3つが使用されます。このうち、SOAPサービスの場合、組込みの拡張定義を使用して定義をおこないます。bindingタグ自体にはname/type属性があり、type属性でどのportTypeをbindするかを指定します。
<binding name="LovemacBinding" type="typens:LovemacPortType">
</binding>
先に書いたようにWSDL1.1では、SOAP 1.1のための定義が組み込まれていますのでこれを使用しSOAP特有の定義をおこないます。
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
type属性にRPCが指定された場合、SOAPメッセージのリクエストにoperation(=メソッド)名とそのパラメータ、レスポンスにその戻り値が含まれることを意味します。また、transport属性ではHTTPプロトコルの使用を宣言しています。
サービスが提供する各operationの定義をおこないます。各operation要素ではそれぞれのoperationで使用する入力(input)と出力(output)を定義する要素をそれぞれに含みます。また、SOAPを使用する場合、soap:operation要素を含みます。
<operation name="ServiceStart">
<soap:operation soapAction="" />
<input name="ServiceStartRequest">
</input>
<output name="ServiceStartResponse">
</output>
</operation>
soap:operation要素ではsoapAction属性を指定できます。SOAP 1.1では必須ですので内容は空白ですが指定する必要があります。
soap:body要素は各operationのinput/output要素の子要素としてメッセージがSOAPエンコーディングで処理されることを定義しています。use属性ではliteralを指定してエンコーディングをしないことも定義できます。
<soap:body use="encoded"
namespace="urn:LovemacService"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
最終的には、bindig要素は以下のようになります。
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="ServiceStart">
<soap:operation soapAction="" />
<input name="ServiceStartRequest">
<soap:body use="encoded"
namespace="urn:LovemacService"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output name="ServiceStartResponse">
<soap:body use="encoded"
namespace="urn:LovemacService"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
<operation name="GetItemInfo">
(略)
</operation>
<operation name="ServiceEnd">
(略)
</operation>