Skip to main content

How to create custom XSL functions using Java code, BPEL - Oracle SOA, XSLT 1.0

This post talks about how to create customized XSL functions with Java code inside BPEL Process(Oracle SOA 11g).

Refer below steps to follow the approach. Using this approach there is no need of placing jar file into oracle commons directory as suggested by oracle documentation. With this approach , if any changes made in java source, composite deployment is needed.

With the Oracle preferred approach(deploying jar in commons directory),deployment of composite is not needed only if  sourcecode in java class doesn't have any changes its method signature.
However,Server restart is must when updated jar being placed in oracle commons directory.
Its up-to the necessity and approach as per organizational/architectural standards.

Even though its not recommend to use Java classes inside XSL transformations, few specific scenarios XSL can't handle. For example, finding difference in the dates is a difficult approach in XSLT 1.0 ,since it does nt have supporting functions. Below example demonstrates to find the age based on DOB input,which essentially needs to calculate date difference.

Step1 : Open SOA project in Jdeveloper and right click on the project and select new >> select Java class >> which opens up below popup >> and create Java class name it as Utils.





Step2 : Create a method as static and  implement method with required logic.In this case , calcAge method has been implemented to find the age based on given input(dob as string).



Step3:  Refer this class as a xml namespace inside XSL transformation. And call calcAge method by passing DOB as input.



Step 4 : Deploy the project into SOA WLS server and test it.

Test Snap1 :

Test Snap2:





Refer this example here.

Comments

Popular posts from this blog

How to control CUDA Devices to be used in Windows 10 for Keras/Theano/TensorFlow training

I've two 1080ti GPUs , I would like to use only one of the device for DeepLearning Training purpose,Most of the google suggestions advising to use CUDA_VISIBLE_DEVICES environment variable.Setting CUDA_VISIBLE_DEVICES either in windows environment variables are as programmatic way dint help much. But below approach helped to control the GPU usage for CUDA operations. Open NVIDIA Control Panel" by right clicking on the desktop screen. And select CUDA-GPUs to the desired gpu you want to use for DL training, In my case: I chose 2nd GPU Peace!!

Send/Receive task vs Throw/Catch Message events in Oracle BPM

In Oracle BPM "Service task" is used for invoking Synchronous web-service calls. It wont be useful for Asynchronous service calls. To deal with  Asynchronous service calls,  Send/Receive or Throw/Catch events need to be used. There are few differences and similarities between Send/Receive and Throw/Catch Message events. Please have a look at them below. Send/Receive Task Throw/Catch Message Events Can it be used to initiate task? Yes Yes Can it be used to call/invoke Synchronous services/processes? No No Can it be used to call/invoke Asynchronous services/processes? Yes Yes Does correlation/conversation need to be set to deal with Asynchronous tasks? Yes Yes Can it have boundary events associated to it? Yes No Can these pair be used to create synchronous process /service? Yes Yes Can these pair be used to create Asynchronous process /service? Yes Yes Send and Receive task example with boundary events attached to it can be fou...