Wednesday, October 2, 2013

Java Embedding Activity in BPEL 1.1 and BPEL 2.0

In this post, let us take a look at Java Embedding Activity usage in BPEL 1.1 and BPEL 2.0.

The Java Embedding Activity syntax in BPEL 2.0 is slightly different when compared to BPEL 1.1. The bpelx:exec extension and Java code are wrapped in an <extensionActivity> element.

Similarly the Custom Java classes import syntax also varies between both the versions.

BPEL 1.1:
   <bpelx:exec import="oracle.xml.parser.v2.XMLElement"/>
   <bpelx:exec name="Logging" version="1.5" language="java">
        <![CDATA[    
        try{        
           XMLElement input= (XMLElement)getVariableData("inputVariable", "payload","/client:process/client:input");              
           addAuditTrailEntry("Input Value is: " + input.getTextContent());    
           }      
           catch(Exception e)          
           {          
           e.printStackTrace();          
           }]]>
    </bpelx:exec>

BPEL 2.0:
    <import location="oracle.xml.parser.v2.XMLElement" importType="http://schemas.oracle.com/bpel/extension/java"/>
    <extensionActivity>
      <bpelx:exec name="Logging" language="java">
        <![CDATA[    
        try{        
           XMLElement input= (XMLElement)getVariableData("inputVariable", "payload","/client:process/client:input");              
           addAuditTrailEntry("Input Value is: " + input.getTextContent());    
           }      
           catch(Exception e)          
           {          
           e.printStackTrace();          
           }]]>
      </bpelx:exec>
    </extensionActivity>

No comments:

Post a Comment

Provide your thoughts !