Thursday, 14 August 2014

BPEL Java Embeding Activity With Message Type Variables Manipulation

In Java Embedding activity we can deal with the BPEL variables using getVariableData() and setVariableData() methods.

For example, the below code snippet in java embedding activity get the input value of the BPEL process and concat it with a string and set the value into the output variable of BPEL.

Element input =(Element)getVariableData("inputVariable","payload","/client:process/client:input");      
Node fc= input.getFirstChild();     
String s = "Hii "+fc.getNodeValue();     
addAuditTrailEntry("Input is : " +s);     
setVariableData("outputVariable","payload","/client:processResponse/client:result", s);

In the BPEL process file go to source view and add the following import statements above the java embedding code snippet.

<bpelx:exec import="org.w3c.dom.Element"/>

<bpelx:exec import="org.w3c.dom.*"/>

Now deploy the project and test it.

Happy Coding :)

No comments:

Post a Comment