Creating a SOAP Header Class

SOAP structures a message into two main parts: the headers and the body. SOAP is not only a sender-receiver protocol but it supports the concept of a message passing from a recipient, possibly through one or more intermediaries, and ending up at its destination, more precisely known as the ultimate receiver.

Along the way, intermediaries can perform processing on the message or its side effects. For example, a message can pass through a transaction service (providing a client with guaranteed invocation in the presence of network failures), a security service can sit at an enterprise portal (providing authentication information), and so on.

As intermediaries work primarily on the metadata of the SOAP message, SOAP headers are the ideal place for such data. In addition, they are also a good place to put optional information and a good way to support evolving interfaces. If session handling is enabled in JADE, for example, JADE uses a SOAP header to pass the session id between the service and the client.

For details about specifying the consumer of a SOAP header and that the consumer must understand the semantics of the header, see "Creating a Web Service Class", in the previous section.

To simplify the use of SOAP headers, JADE provides the JadeWebServiceSoapHeader class that you can subclass.

To create a SOAP header class

The Web Services sheet of the Define Class dialog is then enabled. For details about defining a Web service class, see "Creating a Web Service Class", in the previous section.

The following image shows an example of the Class List of the Class Browser in which the MyHeader class has been created as a subclass of JadeWebServiceSoapHeader, which has a property called count and this is displayed in the Properties List. The value of the count property is included in the SOAP header when the SOAP message is generated.

SOAP headers are defined against Web service methods. For details, see the following section.