Friday, March 21, 2014

Coherence in BPEL

Thanks to Siva's blog i am able to get the required result in my BPEL process.

My project requirement was something like this

Based on a unique identifier as input, call the database and retrieve the information.

The information in the db was static so we thought to enhance the performance by using caching.

We initially though of using OSB layer on top of SOA as OSB provides result caching but then we tried to implementing the same in SOA layer itself.

I will just highlight few errors and mistakes that i got during this.


The first thing is how to get the cachedata

String CacheData= ((oracle.xml.parser.v2.XMLElement) getVariableData ("inputVariable","payload","/client:process/client:input")).getFirstChild().getNodeValue();

how did we reach to getVariableData ("inputVariable","payload","/client:process/client:input")


Drag and drop an assign activity in your BPEL process and expand the input variable




Check out the highlighted section and compare it with the input that we have passed you will be able to make it how as how to draft this.

Next is when you will try to compile this code you will get following error

Error(22,45): Instantiation exception for implementation type "implementation.bpel", validating component "StoreData". Exception is "Failed to compile bpel generated classes.
failure to compile the generated BPEL classes for BPEL process "StoreData" of composite "default/Coherence!1.0"
The class path setting is incorrect.
Ensure that the class path is set correctly. If this happens on the server side, verify that the custom classes or jars which this BPEL process is depending on are deployed correctly. Also verify that the run time is using the same release/version.
"

This is because you have not imported the proper classes which are required to call the methods in your java embedding.

To overcome this issue.

go to the source code of your BPEL process and add the following

<bpelx:exec import="java.lang.*"/>
<bpelx:exec import="com.tangosol.net.NamedCache"/>
<bpelx:exec import="com.tangosol.net.CacheFactory"/>

Now recompile the code and you should be able to resolve the issue faced earlier




No comments: