Wednesday, June 4, 2008

Generating a Unique ID for every request in Oracle BPEL/ESB

A unique ID needs to be assigned to every asynchronous request for tracking the status/uniquely identifying the request message. The ID needs to be universally unique (UUID) that is generated by the Oracle SOA Systems (ESB/BPEL) to correlate the request for future reference. You can take advantage of the XPath Extension Function orcl:generate-guid() that comes out-of-the box and format it accordingly like this:

<copy>
<from expression="orcl:generate-guid()"/>
<to variable="uniqueId"/>
</copy>
<copy>
<from expression="orcl:format-string('{0}-{1}-{2}-{3}-{4}',
substring(bpws:getVariableData('uniqueId'),1,8),
substring(bpws:getVariableData('uniqueId'),9,4),
substring(bpws:getVariableData('uniqueId'),13,4), substring(bpws:getVariableData('uniqueId'),17,4), substring(bpws:getVariableData('uniqueId'),21, 12))"/>
<to variable="outputVariable" part="payload"
query="/client:LoanBrokerBPELProcessResponse/
client:LoanRequestId"/>
</copy>

This will create a variable called LoanRequestId with the required XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX format.


No comments:

Search This Blog