For a project we make extensive use of Oracle SOA with a number of messages exchanged with external parties. These messages need to contain a unique reference to identify the message and to later correlate an incoming response with the request being made. We had to create a so called UUID for this unique identifier of a message.
An UUID contains 32 hexadecimal values divided by a hyphen. The first part contains 8 characters, the next 3 have 4 characters and the last one the remaining 12 characters. So for example 321fac6d-c2ad-42ed-8338-3a56898896d7.
Add an Assign activity in your BPEL design window or use an existing one and open up the copy rules.
Add a new expression and use the below function to generate a GUID. We will assign it for now to a variable called generatedUUID.
oraext:generate-guid()
This will generate a guid, however it does not contain the hyphens. We need to further split this guid up in the earlier mentioned 5 groups.
So add a new expression to split it up.
concat(substring($generatedUUID,1,8),'-',substring($generatedUUID,9,4),'-',substring($generatedUUID,13,4),'-',substring($generatedUUID,17,4),'-',substring($generatedUUID,21))
As you can see the generated GUID is used and with the substring function the 5 groups are being made. To complete our UUID the groups are concatenated with hypens.
So if you ever need a UUID for your SOA project you know what to do. Enjoy!