Skip to main content

SOAP Envelope Elements

Every SOAP message is an XML document with a single root Envelope element. The Envelope contains an optional Header and a required Body. Errors are carried in a Fault element inside the Body.

<soap:Envelope>
<soap:Header> (optional) </soap:Header>
<soap:Body> (required)
<soap:Fault> on error </soap:Fault>
</soap:Body>

</soap:Envelope>

Envelope

Required

The Envelope is the mandatory root element of every SOAP message. It declares the SOAP namespace, which distinguishes SOAP 1.1 from SOAP 1.2. The Envelope wraps the Header (optional) and Body (required). No other elements may appear at the Envelope level per the spec.

1.1: xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" | 1.2: xmlns:soap="http://www.w3.org/2003/05/soap-envelope"

Header

Optional

The Header contains optional metadata blocks: authentication tokens, routing instructions (WS-Addressing), transaction IDs, and tracing context. Each header block can carry mustUnderstand='1' (SOAP 1.1) or mustUnderstand='true' (SOAP 1.2) to mandate that the receiver processes it or returns a MustUnderstand fault.

1.1: Optional. mustUnderstand="1" or "0" | 1.2: Optional. mustUnderstand="true" or "false"

Body

Required

The Body is the mandatory element containing the actual SOAP message payload – the operation and parameters (request) or the return value (response). On error, the Body contains a Fault element. The Body always has exactly one direct child element: the operation wrapper.

1.1: Required. One child element = operation name | 1.2: Required. Same structure.

Fault

Optional

The Fault element appears inside the Body when an error occurs. SOAP Faults carry a fault code (classification), a human-readable string, and optional detail elements. SOAP 1.1 and 1.2 have different Fault structures. HTTP responses carrying a SOAP Fault use status 500, regardless of whether the fault is a client or server error.

1.1: faultcode, faultstring, faultactor, detail | 1.2: Code (Value+Subcode), Reason, Node, Role, Detail