Wednesday, July 21, 2010

New JAX-WS Lightweight API Allows Fast Access and Manipulation of SOAP Headers

SOAP Headers are typically used to pass additional context data to and from SOAP nodes.
JAX-WS provides a SAAJ API rendering of the message that can be queried and manipulated by JAX-WS application handlers.

The SAAJ rendering of a message is heavyweight.
The JAX-WS runtime is optimized to stream inbound and outbound messages. Transforming the message into an intermediate SAAJ rendering is inefficient and increases the memory footprint.

IBM has defined an alternative lightweight API that can be used to access and manipulate SOAP headers from within a JAX-WS handler.

This API is available in version of the WebSphere Application Server:

This API is available in version of the Feature Pack for Web Services:

We've documented the ability to set headers on outbound requests here:
instructions for setting SOAP Headers and retrieve SOAP headers here: instructions for accessing SOAP Headers

Example Usage
Here is an example usage.

Interested Parties:
This solution is applicable if your JAX-WS Web service uses large messages and requires high performance and/or low memory footprint.

This solution is also applicable for customers migrating existing JAX-RPC Web services to JAX-WS.