Java Embedding in Oracle BPEL process
In this section, we walk through about how to call a Java method in BPEL process 2.0.
I have created a Java class in my SOA project as shown below. The class name is FirstJava.java; it has a single method getString which returns a string
Open the BPEL process >> Search Java in the component >> Drag the Java Embedding and drop it to the BPEL process
Double click on the Java Embedding
Input the below code as shown below
FirstJava obj = new FirstJava(); \\ Creating object
String name = obj.getString("catgovind"); \\ Return 'Hello catgovind'
setVariableData("myname", name); \\ set the variable to BPEL process variable 'myname'
Click the Source tab of the BPEL process >> Import the java class below the process element as shown below
<import location=”com.catgovind.FirstJava” importType=”http://schemas.oracle.com/bpel/extension/java”/>
Follow the steps If you want to add a jar file instead of creating Java classes inside the SOA project
1. Export your existing Java project into a Jar file
2. place the jar file inside <SOA_PROJECT_HOME>\SOA\SCA-INF\lib (Example: C:\JDeveloper\mywork\SOAApplication\Project\SOA\SCA-INF\lib)
3. Right-click the SOA project >> Click Properties >> Select Libraries and Classpath >> Click button Add Jar/Directory >> Add the jar file from the SCA_INF\lib directory
4. Follow the remaining screenshots as presented above expect the first image
The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.
Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂