Custom xpath functions in service bus by Milco Numan
December 25, 2016 Leave a comment
How can you create custom XPath functions in Oracle Service Bus 12c? And how can you use these in both XSLT and XQuery? Let’s find it out. I like to show you how they’re different in behaviour.
The context of my post comes from one of my projects, where we were migrating quite some (stateless) services from the SOA (BPEL) platform to Service Bus. Since our clients were already ‘virtualized’ to our clients (i.e. clients invoked them through the Service Bus), we could easily change the implementation platform without changing the service contracts.
For the transformation, we were reusing the existing XSL transformations, so a couple of the custom XPath functions had to be made available in Service Bus. Additionally, we were also introducing the DVM (Domain Value Maps) as a replacement for a custom coded lookup-implementation, created when DVMs did not yet exist. For this purpose, we had to create a custom XPath wrapper function, in order to implement some custom logging that the customer did not want to lose.
Test XPath function
As a simple scenario, I am using base-64 encoding and decoding to be implemented as custom XPath functions (code is shared through GitHub). In order to test the custom XPath function, I have created some very simple proxies and pipelines that do not route to any other service but instead just call upon a transformation in order to test my custom functions:
In the reply element I have three different child elements, the first contains the untransformed contents of the input string and the second contains the base64 encoded contents. The last element contains the value after invoking the decode operation on the encoded string, to verify that the inverse operation restores the original value. Read the complete article here.
For regular information on Oracle SOA Suite become a member in the SOA & BPM Partner Community for registration please visit www.oracle.com/goto/emea/soa (OPN account required) If you need support with your account please contact the Oracle Partner Business Center.