WSDL2.0 <binding>
元素是WSDL 2.0文件的頂級元素。<binding>
用於定義一個系結,其中一個或多個給定操作系結到通訊協定,它包含來自WSDL 2.0擴充套件的可延伸性元素。 <binding>
的語法如下所示:
<wsdl:binding name="nmtoken" interface="qname1" type="uri">
... extensibility elements from WSDL 2.0 extension ...
<wsdl:fault ref="qname2">
... extensibility elements from WSDL 2.0 extension ...
</wsdl:fault>
<wsdl:operation ref="qname3">
... extensibility elements from WSDL 2.0 extension ...
<wsdl:input messageLabel="In">
... extensibility elements from WSDL 2.0 extension ...
</wsdl:input>
<wsdl:output messageLabel="Out">
... extensibility elements from WSDL 2.0 extension ...
</wsdl:output>
<wsdl:infault ref="qname4" messageLabel="In">
... extensibility elements from WSDL 2.0 extension ...
</wsdl:infault>
<wsdl:outfault ref="qname4" messageLabel="Out">
... extensibility elements from WSDL 2.0 extension ...
</wsdl:infault>
</wsdl:operation>
</wsdl:binding>
下面是關於<binding>
元素的解釋:
name="nmtoken"
- 為此系結提供參照名稱。interface="qname1"
- 通過參照<interface>
元素指定介面。type="uri"
- 指定系結型別。ref="qname2"
- 指定介面中定義的故障訊息。ref="qname3"
- 指定介面中定義的操作。messageLabel="In|Out"
- 指定訊息方向。ref="qname4"
- 指定介面中定義的衝突/外部故障。以下是<binding>
元素的範例:
<wsdl:binding name="helloBinding"
interface="hy:helloInterface"
type="http://www.w3.org/ns/wsdl/soap"
wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/">
<wsdl:operation ref="hy:Hello"
wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"/>
</wsdl:binding>
在這個例子中,
helloBinding
定義用來在介面helloInterface
中系結Hello
操作。fault
。