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.
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
Post a Comment