Java embedding in Oracle BPEL Process

Home/BPEL/Java embedding in Oracle BPEL Process

Java Embedding in Oracle BPEL process

In this section, we walk through about how to call a Java method in BPEL process 2.0.

Steps:

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

051916_0554_CallJavamet1 Java embedding  in Oracle BPEL Process

Open the BPEL process >> Search Java in the component >> Drag the Java Embedding and drop it to the BPEL process

051916_0554_CallJavamet2 Java embedding  in Oracle BPEL Process

Double click on the Java Embedding

051916_0554_CallJavamet3 Java embedding  in Oracle BPEL Process

Input the below code as shown below

 

051916_0554_CallJavamet4 Java embedding  in Oracle BPEL Process

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”/>

051916_0554_CallJavamet5 Java embedding  in Oracle BPEL Process

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

pgn Java embedding  in Oracle BPEL Process

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

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 🙂
pgn Java embedding  in Oracle BPEL Process
By | 2016-05-19T01:18:03+00:00 May 19th, 2016|Categories: BPEL|Tags: , |1 Comment
  • Saurabh

    Thanks for the wonderful article.

    I am facing one difficulty in importing Standard Java Classes.

    If I have to use File Class (java.io.File), then even after putting an import statement at the start of the BPEL like

    I still need to refer the File Class in Embedded java code by giving the entire package structure like

    java.io.FileOutputStream fos = new java.io.FileOutputStream(new java.io.File(“Test.txt”));

    If I just write the above statement as

    FileOutputStream fos = new FileOutputStream(new File(“Test.txt”));

    Then I get error during build.

    Can you please suggest, what is going wrong.

Like us on Facebook.
Connect!