Skip to content

Latest commit

 

History

History
88 lines (57 loc) · 5.28 KB

File metadata and controls

88 lines (57 loc) · 5.28 KB

SOAP in brief

This document gives a rough and incomplete overview of SOAP 1.2.

Note
The reader supposedly has basic knowledge of HTTP and XML.

Overview

The Simple Object Access Protocol (SOAP) specification defines (non exhaustive list):

  • an abstract exchange protocol of (specific species of) XML Infosets;

  • a binding that specifies how those XML Infosets are to be serialized (and more, see below).

XML Infoset

  • An XML Infoset is an abstract data type. Serialization transforms the XML Infoset into a concrete representation in bytes.

  • An obvious example of serialization of an XML Infoset is the XML serialization (<book><title>Sir</title></book>), but others are conceivable (some encrypted serialization for example) or exist. As an example, the W3C SOAP Message Transmission Optimization Mechanism (MTOM) spec defines an optimized serialization of SOAP messages.

SOAP transmission

A SOAP transmission may involve several nodes having distinct roles. Two special roles are the Initial SOAP sender and the Ultimate SOAP receiver roles.

SOAP message

SOAP typically transmits SOAP messages. A SOAP message is a species of XML Infoset. It has an env:Envelope root element, which may contain two sub-elements. (The env prefix corresponds to the namespace name http://www.w3.org/2003/05/soap-envelope.)

  • The env:Header optional sub-element may serve to give informations to SOAP processing nodes (and may be altered by those nodes) on the way from the initial sender to the ultimate receiver.

  • The env:Body mandatory sub-element has application-specific content. It is empty or contains a sub-element from a possibly application-specific namespace.

See example 1 (from SOAP spec part 1).

Binding

A binding makes SOAP transmission concrete. It specifies:

  • how to serialize XML Infosets;

  • mechanisms to support features (that extend the transmission protocol), such as the SOAP Web Method feature, the Message Exchange Patterns (MEPs) feature (see below), or the SOAP Action feature (not explained here).

The Message Exchange Patterns feature

The spec defines two basic MEPs:

  • SOAP Response: involves a non-SOAP request and a SOAP response;

  • SOAP Request-Response: involves a SOAP request and a SOAP response.

The HTTP binding

The spec specifies what a SOAP binding is in general (see above), and specifies one such concrete binding, namely the HTTP one.

This binding has two MEPs (that consist in further specifying the two basic MEPs seen above).

  • SOAP Response: an HTTP GET followed by an HTTP response that contains a SOAP message as a body;

  • SOAP Request-Response: an HTTP POST containing a SOAP body, followed by a response as above.

The application/soap+xml media type is (typically) used in those exchanges.

Despite forceful argumentation in the spec in favor of applying the SOAP Response MEP when appropriate, most implementations only consider the SOAP Request-Response MEP (possibly with an empty body in the request).

SOAP RPC

The spec defines how SOAP may be used for Remote Procedure Calls (RPCs).

  • A procedure is viewed as a named operation that has input parameters, output parameters, possibly a return value, and fault types (that can be used instead of outputs and return values). Some parameters may be both input and output.

  • A RPC invocation has, as SOAP body, a struct named after the invoked operation and with children corresponding to the input parameters.

  • A RPC response has, as SOAP body, a struct with a child response in namespace http://www.w3.org/2003/05/soap-rpc (if the procedure declares a return value) and other children for other output parameters.

  • Encoding of such structs into the SOAP body is left to be defined by the application.

Refs

  • W3C SOAP recommendation

  • W3C SOAP primer (I recommend it, it’s clear and short)

  • Web Services Interoperability (WS-I) Basic Profile (BP) clarifies and modifies SOAP and related specifications to promote interoperability.

Supplementary details

The spec defines a specific encoding, SOAP encoding, for structs used in RPCs, but it is not used anymore. (See WSDL in brief.)

A SOAP Web Method is one of GET, POST, PUT, DELETE, understood as their HTTP equivalent. The SOAP Web Method feature permits to specify which SOAP Web Method is to be used for a given SOAP message exchange. This feature is available for use in any binding.

The HTTP binding also requires support for the SOAP Action feature and for the SOAP Web Method feature. The latter is restricted to value "GET" or "POST", depending on the chosen MEP.

The SOAP spec permits multiple elements inside a body element inside the envelope, but BP R9981 modifies this.

SOAP 1.1 uses the http://schemas.xmlsoap.org/soap/envelope/ namespace and text/xml instead of application/soap+xml media type.