web analytics
free online training

Java Embedding Activity in BPEL

Java embedding activity is a means of embedding Java and J2EE code directly inside Oracle process. Even though java embedding can provide enhanced functionality (since you can plug in any java code here!!), this should be avoided as much as possible – since the code would be harder to manage and will not be “SOA” like. Since this is an Oracle extension, it is not part of standard spec – hence won’t be portable!!

In this example, we have a simple hello java project which takes an input value and returns simple hello response back to the user. The process modifies the instance title, adds audit trail entries for more detailed logging in process flow. In this example, the java code is part of SOA application and hence will be compiled and be available in the class path after deployment. You can add jar files of the java project to the classpath (either at project level or at system level) if the functionality is part of another system or if you want to manage it separately!!

Some Screenshots

Create a simple java class for calling from embed activity

Java Embedding activity
Use Java embedding activity in BPEL to call the custom java class directly from BPEL.

Import library
Use import statements to import classes and libraries before using in java embedding. Easiest way is to use bpelx:exec statement import attribute.

Initialize Output Variable
Before you can set a particular element in a variable (for eg. outputVariable/processResponse/result), the variable needs to be initialized. Note that Oracle BPEL auto initializes these variables with the correct structure first time its used (for eg. in assign statement). So, either initialize the message structure yourself in java embedding or do a dummy assign to outputVariable such that it gets initialized!!!

Final BPEL Flow
Finally the BPEL flow looks like below.

Instance Flow Trace
Instance flow trace has additional audit trail entries we have added from java.

Instance Title
Instance title has been successfully modified from java embedding.

  1. Hai Chethan when i working on JavaEmbedding iam geting a error at compilation time in Composite.xml Error is SCAC-50012

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
    • Make sure your java embedding has all the imports applied in the bpelx file. set the imports in the bpelx:exec tag

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
  2. Hi,

    How to use OID use Java embedded activity…

    And also to implement the Scheduling the Task at 8am daily use Java embedded based BPEL implementation…

    Can u throw some idea…


    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
Leave a Reply

goin up