- WSDL Basics
- WSDL Elements
- The Extensible WSDL Framework
- Importing WSDL Elements
- WSDL-Related Namespaces
- Extensions for Binding to SOAP
- Summary
Extensions for Binding to SOAP
Because SOAP is the most popular transport for WSDL, it's important to cover its binding in further detail. The SOAP specification contains predefined rules for physically representing such data types as Booleans, integers, and arrays. Binding to SOAP therefore requires the abstract data types, messages, and operations to be bound to concrete physical representations on the wire. The WSDL <binding> element associates a port type with a port to define the concrete aspects of operations. For example:
<binding name='InSeasonOrderBinding' type='wsdlns:InSeasonOrderPort' > .... </binding>
Note
SOAP is the most important binding for WSDL
The named binding attribute is also required for the WSDL <port> element. Inside the <binding> element is a WSDL SOAP extension element called <soap:binding>, which specifies the physical transport protocol and the style of request: RPC or document. For example:
<soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/ http' />
This example defines the RPC style of interaction for a SOAP mapping to HTTP. For each operation within the service, the value of the SOAPAction HTTP header has to be included. SOAPAction is an HTTP header that the requesting system sends when it invokes the service. The SOAP processor on the receiving system can use the header to determine the ultimate destination of the service. For example:
<binding name='InSeasonOrderBinding' type='wsdlns:InSeasonOrderPort' > <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/ soap/http' /> <operation name='OrderEntry' > <soap:operation soapAction='http://www.skateboots.com/ order/OrderManagement.OrderEntry' /> .... </operation> </binding>
Note
The SOAP Action HTTP header is required
The <operation> element contains the same name as the operation defined earlier. A <soap:operation> with the soapAction attribute is included within this <operation> to show that the ultimate destination of the message is the OrderEntry service in the /order folder.
Next, the encoding mechanism for the input and the output messages must be specified, as shown here.
<binding name='InSeasonOrderBinding' type='wsdlns:InSeasonOrderPort' > <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http' /> <operation name='OrderEntry' > <soap:operation soapAction='http://www.skateboots.com/action/ OrderManagement.OrderEntry' /> <input> <soap:body use='encoded' namespace='http://www.skateboots.com/typesIn/' encodingStyle='http://schemas.xmlsoap.org/soap/ encoding/' /> </input> <output> <soap:body use='encoded' namespace='http://www.skateboots.com/typesOut/' encodingStyle='http://schemas.xmlsoap.org/soap/ encoding/' /> </output> </operation> </binding>
Both the <input> and the <output> elements use a <soap:body> element to specify data type encoding rules. The URI references the optional SOAP encoding style, meaning that it will be used for the serialization, or data type encoding, of the input and output messages.