Project Ode has retired. For details please refer to its Attic page.
Apache ODE – Headers Handling

Headers Handling

Overview

There are several situations where one would want to access headers form the wire format in their BPEL process. It could be to assign them to another message and pass them around or to execute some business logic that's header-dependent (often a bad idea but sometimes there's no choice). ODE supports the manipulation of wire format headers in two different ways.

Headers as Abstract Message Parts

In SOAP, message parts can be bound to a SOAP header. This requires to define all the parts that you want to extract in the abstract message definition and then create an appropriate binding to specify the parts that actually go in the header.

Once this is done, the header part is actually physically present in the abstract message definition and can be accessed like any other message part in your process. Headers can therefore be assigned using the classic from/part and to/part assignments, no specific extension is needed.

Dynamic Headers

When headers aren't declared in the WSDL abstract message (or even in the binding), ODE still checks which headers are present in the exchanged SOAP messages and retrieve them. Those are dynamic headers, there's no validation as to which headers are present or absent, ODE just takes what's there.

Those headers can't be manipulated and assigned directly like a normal part as they don't have a part definition. So ODE supports a specific and additional type of and for assignments:

<from variable="BPELVariableName" header="NCName"?>
   <query queryLanguage="anyURI"?>?
      queryContent
   </query>
</from>

<to variable="BPELVariableName" header="NCName"?>
   <query queryLanguage="anyURI"?>?
      queryContent
   </query>
</to>

Using these and specifications, dynamic headers can be accessed and manipulated in your BPEL process. For example, passing a ConversationId SOAP header from an incoming to an outgoing message could look like:

<copy>
     <from variable="inputMsg" header="ConversationId"/>
     <to variable="outputMsg" header="ConversationId"/>
</copy>

Note that SOAP headers being always elements, a simple type (like a string) can't be used to assign to a header.