SOAP Header Element
The optional SOAP Header element contains header information.
SOAP Header Element
The optional SOAP Header element may contain application-specific information about the SOAP message (such as authentication, payment, etc.).
If a Header element is provided, it must be the first child element of the Envelope element.
Note: All direct child elements of the Header element must be namespace-qualified.
xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> soap:mustUnderstand="1">234 ... ...
The example above contains a header with a "Trans" element whose value is 234, and whose "mustUnderstand" attribute has the value "1".
SOAP defines three attributes in the default namespace ("http://www.w3.org/2001/12/soap-envelope").
These three attributes are: actor, mustUnderstand, and encodingStyle. Defined in the SOAP header, these attributes determine how the container processes the SOAP message.
The mustUnderstand Attribute
The SOAP mustUnderstand attribute is used to identify whether a header item is mandatory or optional for the recipient that processes it.
If you add "mustUnderstand="1"" to a child element of the Header element, it indicates that the recipient processing this header must recognize the element. If the recipient cannot recognize it, processing of the header must fail.
Syntax
soap:mustUnderstand="0|1"
Example
xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> soap:mustUnderstand="1">234 ... ...
The actor Attribute
By traveling along a message path through different endpoints, a SOAP message can propagate from a sender to a recipient. Not all parts of a SOAP message are intended to be delivered to the ultimate endpoint of the SOAP message; however, some parts may be intended for one or more endpoints along the message path.
The SOAP actor attribute can be used to address a Header element to a specific endpoint.
Syntax
soap:actor="
URI
"
Example
xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> soap:actor="http://www.w3schools.com/appml/">234 ... ...
The encodingStyle Attribute
The SOAP encodingStyle attribute is used to define the data types used in the document. This attribute may appear in any SOAP element and applies to the element's content and all of its child elements.
A SOAP message has no default encoding scheme.
Syntax
soap:encodingStyle="
URI
"