Pages

1/16/2008

How the SOAP Binding Extends WSDL

How the SOAP Binding Extends WSDL

The SOAP Binding extends WSDL with the following extension elements:

<definitions .... >

<binding .... >

<soap:binding style="rpc|document" transport="uri">

<operation .... >

<soap:operation soapAction="uri"? style="rpc|document"?>?

<input>

<soap:body parts="nmtokens"? use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?>

<soap:header message="qname" part="nmtoken" use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?>*

<soap:headerfault message="qname" part="nmtoken" use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?/>*

<soap:header>

</input>

<output>

<soap:body parts="nmtokens"? use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?>

<soap:header message="qname" part="nmtoken" use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?>*

<soap:headerfault message="qname" part="nmtoken" use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?/>*

<soap:header>

</output>

<fault>*

<soap:fault name="nmtoken" use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?>

</fault>

</operation>

</binding>

<port .... >

<soap:address location="uri"/>

</port>

</definitions>

Each extension element of the SOAP binding is covered in subsequent sections.

3.3 soap:binding

The purpose of the SOAP binding element is to signify that the binding is bound to the SOAP protocol format: Envelope, Header and Body. This element makes no claims as to the encoding or format of the message (e.g. that it necessarily follows section 5 of the SOAP 1.1 specification).

The soap:binding element MUST be present when using the SOAP binding.

<definitions .... >

<binding .... >

<soap:binding transport="uri"? style="rpc|document"?>

</binding>

</definitions>

The value of the style attribute is the default for the style attribute for each contained operation. If the style attribute is omitted, it is assumed to be "document". See section 3.4 for more information on the semantics of style.

The value of the required transport attribute indicates which transport of SOAP this binding corresponds to. The URI value http://schemas.xmlsoap.org/soap/http corresponds to the HTTP binding in the SOAP specification. Other URIs may be used here to indicate other transports (such as SMTP, FTP, etc.).

3.4 soap:operation

The soap:operation element provides information for the operation as a whole.

<definitions .... >

<binding .... >

<operation .... >

<soap:operation soapAction="uri"? style="rpc|document"?>?

</operation>

</binding>

</definitions>

The style attribute indicates whether the operation is RPC-oriented (messages containing parameters and return values) or document-oriented (message containing document(s)). This information may be used to select an appropriate programming model. The value of this attribute also affects the way in which the Body of the SOAP message is constructed, as explained in Section 3.5 below. If the attribute is not specified, it defaults to the value specified in the soap:binding element. If the soap:binding element does not specify a style, it is assumed to be "document".

The soapAction attribute specifies the value of the SOAPAction header for this operation. This URI value should be used directly as the value for the SOAPAction header; no attempt should be made to make a relative URI value absolute when making the request. For the HTTP protocol binding of SOAP, this is value required (it has no default value). For other SOAP protocol bindings, it MUST NOT be specified, and the soap:operation element MAY be omitted.

3.5 soap:body

The soap:body element specifies how the message parts appear inside the SOAP Body element.

The parts of a message may either be abstract type definitions, or concrete schema definitions. If abstract definitions, the types are serialized according to some set of rules defined by an encoding style. Each encoding style is identified using a list of URIs, as in the SOAP specification. Since some encoding styles such as the SOAP Encoding (http://schemas.xmlsoap.org/soap/encoding/) allow variation in the message format for a given set of abstract types, it is up to the reader of the message to understand all the format variations: "reader makes right". To avoid having to support all variations, a message may be defined concretely and then indicate it’s original encoding style (if any) as a hint. In this case, the writer of the message must conform exactly to the specified schema: "writer makes right".

The soap:body binding element provides information on how to assemble the different message parts inside the Body element of the SOAP message. The soap:body element is used in both RPC-oriented and document-oriented messages, but the style of the enclosing operation has important effects on how the Body section is structured:

  • If the operation style is rpc each part is a parameter or a return value and appears inside a wrapper element within the body (following Section 7.1 of the SOAP specification). The wrapper element is named identically to the operation name and its namespace is the value of the namespace attribute. Each message part (parameter) appears under the wrapper, represented by an accessor named identically to the corresponding parameter of the call. Parts are arranged in the same order as the parameters of the call.
  • If the operation style is document there are no additional wrappers, and the message parts appear directly under the SOAP Body element.

The same mechanisms are used to define the content of the Body and parameter accessor elements.

<definitions .... >

<binding .... >

<operation .... >

<input>

<soap:body parts="nmtokens"? use="literal|encoded"?

encodingStyle="uri-list"? namespace="uri"?>

</input>

<output>

<soap:body parts="nmtokens"? use="literal|encoded"?

encodingStyle="uri-list"? namespace="uri"?>

</output>

</operation>

</binding>

</definitions>

The optional parts attribute of type nmtokens indicates which parts appear somewhere within the SOAP Body portion of the message (other parts of a message may appear in other portions of the message such as when SOAP is used in conjunction with the multipart/related MIME binding). If the parts attribute is omitted, then all parts defined by the message are assumed to be included in the SOAP Body portion.

The required use attribute indicates whether the message parts are encoded using some encoding rules, or whether the parts define the concrete schema of the message.

If use is encoded, then each message part references an abstract type using the type attribute. These abstract types are used to produce a concrete message by applying an encoding specified by the encodingStyle attribute. The part names, types and value of the namespace attribute are all inputs to the encoding, although the namespace attribute only applies to content not explicitly defined by the abstract types. If the referenced encoding style allows variations in it’s format (such as the SOAP encoding does), then all variations MUST be supported ("reader makes right").

If use is literal, then each part references a concrete schema definition using either the element or type attribute. In the first case, the element referenced by the part will appear directly under the Body element (for document style bindings) or under an accessor element named after the message part (in rpc style). In the second, the type referenced by the part becomes the schema type of the enclosing element (Body for document style or part accessor element for rpc style). For an example that illustrates defining the contents of a composite Body using a type, see section 2.3.1. The value of the encodingStyle attribute MAY be used when the use is literal to indicate that the concrete format was derived using a particular encoding (such as the SOAP encoding), but that only the specified variation is supported ("writer makes right").

The value of the encodingStyle attribute is a list of URIs, each separated by a single space. The URI's represent encodings used within the message, in order from most restrictive to least restrictive (exactly like the encodingStyle attribute defined in the SOAP specification).

3.6 soap:fault

The soap:fault element specifies the contents of the contents of the SOAP Fault Details element. It is patterned after the soap:body element (see section 3.5).

<definitions .... >

<binding .... >

<operation .... >

<fault>*

<soap:fault name="nmtoken" use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?>

</fault>

</operation>

</binding>

</definitions>

The name attribute relates the soap:fault to the wsdl:fault defined for the operation.

The fault message MUST have a single part. The use, encodingStyle and namespace attributes are all used in the same way as with soap:body (see section 3.5), only style="document" is assumed since faults do not contain parameters.

3.7 soap:header and soap:headerfault

The soap:header and soap:headerfault elements allows header to be defined that are transmitted inside the Header element of the SOAP Envelope. It is patterned after the soap:body element (see section 3.5).

It is not necessary to exhaustively list all headers that appear in the SOAP Envelope using soap:header. For example, extensions (see section 2.1.3) to WSDL may imply specific headers should be added to the actual payload and it is not required to list those headers here.

<definitions .... >

<binding .... >

<operation .... >

<input>

<soap:header message="qname" part="nmtoken" use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?>*

<soap:headerfault message="qname" part="nmtoken" use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?/>*

<soap:header>

</input>

<output>

<soap:header message="qname" part="nmtoken" use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?>*

<soap:headerfault message="qname" part="nmtoken" use="literal|encoded"

encodingStyle="uri-list"? namespace="uri"?/>*

<soap:header>

</output>

</operation>

</binding>

</definitions>

The use, encodingStyle and namespace attributes are all used in the same way as with soap:body (see section 3.5), only style="document" is assumed since headers do not contain parameters.

Together, the message attribute (of type QName) and the part attribute (of type nmtoken) reference the message part that defines the header type. The schema referenced by the part MAY include definitions for the soap:actor and soap:mustUnderstand attributes if use="literal", but MUST NOT if use="encoded". The referenced message need not be the same as the message that defines the SOAP Body.

The optional headerfault elements which appear inside soap:header and have the same syntax as soap:header) allows specification of the header type(s) that are used to transmit error information pertaining to the header defined by the soap:header. The SOAP specification states that errors pertaining to headers must be returned in headers, and this mechanism allows specification of the format of such headers.

3.8 soap:address

The SOAP address binding is used to give a port an address (a URI). A port using the SOAP binding MUST specify exactly one address. The URI scheme specified for the address must correspond to the transport specified by the soap:binding.

<definitions .... >

<port .... >

<binding .... >

<soap:address location="uri"/>

</binding>

</port>

</definitions>

Post a Comment