WSDL 2.0 - binding
Jakob Jenkov |
The WSDL binding
element describes how your web service is bound to a protocol. In other
words, how your web service is accessible. To be accessible, the web service must be reachable using
some network protocol. This is called "binding" the web service to the protocol. And this is what
the binding
element does.
Here is a binding
example:
<binding name="latestTutorialSOAPBinding" interface="tns:latestTutorialInterface" type="http://www.w3.org/ns/wsdl/soap" wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"> <fault ref="tns:invalidDateFault" wsoap:code="soap:Sender"/> <operation ref="tns:latestTutorialOperation" wsoap:mep="http://www.w3.org/2003/05/soap/mep/soap-response"/> </binding>
The binding name
is referenced by the service
element. Thus it should
be unique within the WSDL file.
The interface
attribute should refer to the name of an interface
element defined
in this WSDL file. Hence the tns:
prefix (in this WSDL's Target Name Space).
The type
attribute tells what kind of message format the interface is bound to. The value in
the example states that the message format is SOAP.
The wsoap:protocol
attribute specifies a SOAP binding - in other words, how the SOAP messages
are transported. The value in the example specifies HTTP.
The operation
element references an operation defined in the interface
that this
binding
refers to. This references is made by the ref
attribute. Notice the
tns:
prefix again, pointing to a name defined inside this WSDL.
The wsoap:mep
attribute of the operation
element, specifies a Message Exchange Pattern (MEP),
which is a SOAP thing. See the the WSDL spec for more detail on this attribute.
The fault
element defines a fault which may be sent back by the web service, via this binding.
The fault
element references a fault defined in the interface
element this
binding
refers to. See the WSDL spec for more detail on this attribute.
Tweet | |
Jakob Jenkov |