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:
Child elements
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.
No hay comentarios:
Publicar un comentario
Te agradezco tus comentarios. Te esperamos de vuelta.