Recently at a customer one of the Oracle Service Bus developers complained to me that using Xpath mappings in the OSB can be quite complex. The reason of the remark was that with the Assign action custom variables were set and later in the service the OEPE graphical mapper only shows the default $body, $header, etc variables. However the Oracle Service Bus IDE allows the definition of custom variables.
First in this example we use the Assign action to create our own variable $body_original which in this example is just acopy of the original received $body message.
After this we select the Variables section on one of our actions in the stage we need to map the $body_original message. Click on the Add button and a pop-up should appear. The structure label is nothing more then some sort of “group” where the variable will be stored. The Structure Path however is used to define the variabel name you assigned earlier and on runtime will be stored in memory. In this example we used $body_original.
The result should then look like something here below. The new variable is known in the OEPE IDE and the structure of the XML message is shown.
When we look at a Replace, Assign or any other action we now have the chance to easily map with the custom variable $body_original. In our example not a big deal since the XPath statement is very simple, but when using very big and complex XSD (for instance with imports) this is very handy since it prevents you from making namespace or XPath mistakes.
- Variable structures defined in your IDE will only be visible for the actions within that specific Stage.
- Variable structures define the structure of the variable (in this example the XML structure) but do NOT define the variable itself.
- Oracle: Working with variable structures