Working with SOAP Headers with Turmeric SOA

Many existing enterprise web services use or require the use of a variety of the WS-* specifications. Including WS-Security, WS-Policy, WS-Reliable Messaging, an others. Many of the WS-* specifications make use of the soap:header. Even though Turmeric SOA will generate classes for items defined in the WSDL for the soap:header if there are types defined, it doesn’t de-serialise these into the generated classes. Instead it generates a set of ObjectNode interfaces.

The ObjectNode interface is a custom representation of the W3C Node interface.  The difference between ObjectNode and the W3C Node is that it does not require items to be text string representations for values.  This allows Turmeric SOA to support a variety of data formats, including XML FastInfoSet for the services.   The soap:header element is available from the MessageContext as ObjectNodes.

There are a number of ways in which you can process or access the soap:header elements using turmeric.

Each serves a different purpose.  For WS-Security one might implement a pipeline handler that verifies the security credentials using a library like the Apache WSSJ project.   If there are special routing requirements to be handled, like for WS-ReliableMessaging, one might implement these as part of a SOAPProtocolProcessor pipeline.

The MessageContext can also be access by the Request Dispatcher and a custom ObjectFactory implementation.    If your service implementation itself needs to access the soap:headers directly, then use of the MessageContextAccessorImpl class is required.

The MessageContext interface contains a variety of information including the raw forms of the soap:header and soap:body.   Other information include in the MessageContext:

  • Service Admin Name
  • Protocol Processor being used.
  • Request Message
  • Request Response
  • Authenticated User ID
  • Service Address
  • Client Address
  • Error, Warnings
  • Security Context

The soap:header is specifically part of the Request Message.    The RequestMessage.getMessageHeader() contains information it will be available as ObjectNodes.   If the protocol doesn’t support or contain a header, this value will return null.

So there are multiple ways, to access the soap:header, and variety of points to do so.  How and when to access will depend on your particular service needs.  Upcoming entries will look at using the STAR WS 4.0 web service specification to implement a generic transport that conforms to the STAR Level 1 rules and requirements.

Advertisements
This entry was posted in open source, security, turmeric, web services, wsdl. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s