|
SOAP 1.2 has been created by Eric Johnson (May 14, 2007). Content:Adding a SOAP 1.2 BindingUsing wsdltosoapTo generate a SOAP 1.2 binding using wsdltosoap use the following command: wsdl2soap [[-?] | [-help] | [-h]] {-iport-type-name} [-bbinding-name] {-soap12} [-doutput-directory] [-ooutput-file]
[-nsoap-body-namespace] [-style (document/rpc)] [-use (literal/encoded)] [ -v] [[ -verbose] | [-quiet]] wsdlurl
The command has the following options:
The -i port-type-name and wsdlurl arguments are required. If the -style rpc argument is specified, the -n soap-body-namspace argument is also required. All other arguments are optional and may be listed in any order.
Splitting messages between body and headerThe message part inserted into the SOAP header can be any valid message part from the contract. It can even be a part from the parent message which is being used as the SOAP body. Because it is unlikely that you would want to send information twice in the same message, the SOAP 1.2 binding provides a means for specifying the message parts that are inserted into the SOAP body. The wsoap12:body element has an optional attribute, parts, that takes a space delimited list of part names. When parts is defined, only the message parts listed are inserted into the body of the SOAP 1.2 message. You can then insert the remaining parts into the message's header.
ExampleSOAP 1.2 Binding with a SOAP Header shows a modified version of the orderWidgets service shown in Ordering System Interface. This version has been modified so that each order has an xsd:base64binary value placed in the header of the request and response. The header is defined as being the keyVal part from the widgetKeymessage. In this case you would be responsible for adding the application logic to create the header because it is not part of the input or output message. SOAP 1.2 Binding with a SOAP Header <?xml version="1.0" encoding="UTF-8"?> <definitions name="widgetOrderForm.wsdl" targetNamespace="http://widgetVendor.com/widgetOrderForm" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://widgetVendor.com/widgetOrderForm" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://widgetVendor.com/types/widgetTypes" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <types> <schema targetNamespace="http://widgetVendor.com/types/widgetTypes" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <element name="keyElem" type="xsd:base64Binary"/> </schema> </types> <message name="widgetOrder"> <part name="numOrdered" type="xsd:int"/> </message> <message name="widgetOrderBill"> <part name="price" type="xsd:float"/> </message> <message name="badSize"> <part name="numInventory" type="xsd:int"/> </message> <message name="widgetKey"> <part name="keyVal" element="xsd1:keyElem"/> </message> <portType name="orderWidgets"> <operation name="placeWidgetOrder"> <input message="tns:widgetOrder" name="order"/> <output message="tns:widgetOrderBill" name="bill"/> <fault message="tns:badSize" name="sizeFault"/> </operation> </portType> <binding name="orderWidgetsBinding" type="tns:orderWidgets"> <wsoap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="placeWidgetOrder"> <wsoap12:operation soapAction="" style="document"/> <input name="order"> <wsoap12:body use="literal"/> <wsoap12:header message="tns:widgetKey" part="keyVal"/> </input> <output name="bill"> <wsoap12:body use="literal"/> <wsoap12:header message="tns:widgetKey" part="keyVal"/> </output> <fault name="sizeFault"> <wsoap12:body use="literal"/> </fault> </operation> </binding> ... </definitions> You could modify SOAP 1.2 Binding with a SOAP Header so that the header value was a part of the input and output messages as shown in SOAP 1.2 Binding for orderWidgets with a SOAP Header. In this case keyVal is a part of the input and output messages. In the wsoap12:body elements the parts attribute specifies that keyVal is not to be inserted into the body. However, it is inserted into the header. SOAP 1.2 Binding for orderWidgets with a SOAP Header <?xml version="1.0" encoding="UTF-8"?> <definitions name="widgetOrderForm.wsdl" targetNamespace="http://widgetVendor.com/widgetOrderForm" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://widgetVendor.com/widgetOrderForm" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd1="http://widgetVendor.com/types/widgetTypes" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"> <types> <schema targetNamespace="http://widgetVendor.com/types/widgetTypes" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <element name="keyElem" type="xsd:base64Binary"/> </schema> </types> <message name="widgetOrder"> <part name="numOrdered" type="xsd:int"/> <part name="keyVal" element="xsd1:keyElem"/> </message> <message name="widgetOrderBill"> <part name="price" type="xsd:float"/> <part name="keyVal" element="xsd1:keyElem"/> </message> <message name="badSize"> <part name="numInventory" type="xsd:int"/> </message> <portType name="orderWidgets"> <operation name="placeWidgetOrder"> <input message="tns:widgetOrder" name="order"/> <output message="tns:widgetOrderBill" name="bill"/> <fault message="tns:badSize" name="sizeFault"/> </operation> </portType> <binding name="orderWidgetsBinding" type="tns:orderWidgets"> <wsoap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="placeWidgetOrder"> <wsoap12:operation soapAction="" style="document"/> <input name="order"> <wsoap12:body use="literal" parts="numOrdered"/> <wsoap12:header message="tns:widgetOrder" part="keyVal"/> </input> <output name="bill"> <wsoap12:body use="literal" parts="bill"/> <wsoap12:header message="tns:widgetOrderBill" part="keyVal"/> </output> <fault name="sizeFault"> <wsoap12:body use="literal"/> </fault> </operation> </binding> ... </definitions> |
Unsubscribe or edit your notifications preferences
