Copyright © 2014 by tutorialspoint
SOAP Header Element
The optional Header element offers a flexible framework for specifying additional
application-level requirements. For example, the Header element can be used to specify a
digital signature for password-protected services; likewise, it can be used to specify an
account number for pay-per-use SOAP services.
SOAP Header element can be explained as:
Header elements are optional part of SOAP messages.
Header elements can occur multiple times.
Headers are intended to add new features and functionality
The SOAP header contains header entries defined in a namespace.
The header is encoded as the first immediate child element of the SOAP envelope.
When more than one header is defined, all immediate child elements of the SOAP header are interpreted as SOAP header blocks.
SOAP Header element can have following two attributes
The SOAP protocol defines a message path as a list of SOAP service nodes. Each of these intermediate nodes can perform some processing and then forward the message to the next node in the chain. By setting the Actor attribute, the client can specify the recipient of the SOAP header.
Indicates whether a Header element is optional or mandatory. If set to true ie. 1 the recipient must understand and process the Header attribute according to its defined semantics, or return a fault.
Following example shows how to use a Header in the SOAP message.