Apache ODE: Dynamic Headers (SOAP Headers)

SOAP headers that are not declaed in WSDL bindings can be used in ODE. If messages are present in the SOAP header they will be used but there is no validation as in other case (Headers as Abstract Message Parts)
I have attached the 2 test processes that I developed. They don’t have any fault handling at present but in production we need to handle faults since there can be no/different headers. Search for the part of code that says :-

                                                <bpel:copy>
<bpel:from>$input.payload//tns:input</bpel:from>
<bpel:to variable="output" header="ConversationId"></bpel:to>
</bpel:copy>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

In this case it is copying the input variable and adding header to the SOAP output. Similarly in the other case it is parsing the required field from the header.

Add header:-

Input

  1: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hel="http://helloWorld">
  2:    <soapenv:Header/>
  3:    <soapenv:Body>
  4:       <hel:HelloWorldRequest>
  5:          <hel:input>Test</hel:input>
  6:       </hel:HelloWorldRequest>
  7:    </soapenv:Body>
  8: </soapenv:Envelope>
  9: 

Output

  1: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  2:    <soapenv:Header>
  3:       <input xmlns="http://helloWorld">Test</input>
  4:    </soapenv:Header>
  5:    <soapenv:Body>
  6:       <HelloWorldResponse xmlns="http://helloWorld">
  7:          <tns:result xmlns:tns="http://helloWorld"/>
  8:       </HelloWorldResponse>
  9:    </soapenv:Body>
 10: </soapenv:Envelope>
 11: 

Parse Header:-

Input

  1: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hel="http://helloWorld">
  2:    <soapenv:Header>
  3:                 <hel:ConversationId>This header will be parsed to get this message</hel:ConversationId>
  4:    </soapenv:Header>
  5:    <soapenv:Body>
  6:       <hel:HelloWorldRequest>
  7:          <hel:input>?</hel:input>
  8:       </hel:HelloWorldRequest>
  9:    </soapenv:Body>
 10: </soapenv:Envelope>
 11: 

Output

  1: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  2:    <soapenv:Body>
  3:       <HelloWorldResponse xmlns="http://helloWorld"> This header will be parsed to get this message </HelloWorldResponse>
  4:    </soapenv:Body>
  5: </soapenv:Envelope>
  6: 

Code

Advertisements

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