Posted by: Waqas Noor on: May 16, 2009
Sometime we need to execute java code within BPEL Process, One possibility is to write java code within BPEL Process by using tag. WSIF is another way to do same thing. In this document, I will not compare these two ways to access the Java Code but the way to use the WSIF.
In this document we will do the following things:
• Create the Java Classes, and exposed as J2EE Web Services (details are in later part of document).
• Invoke the Web Services (Java Class as Web Services) from BPEL Process.
• Place classes somewhere such that classes available at runtime
Java Code as Web Service:
Create java classes which you want to expose as Web Service. In my case, I have created two classes “Greeting.java” and “Person.java”. To create the web service, right click on class and click on “create J2EE Web Service”.
The new dialogue box open as shown in figure below, select the “SOAP 1.1 Binding” and “WSIF Binding”.

After selecting the options mentioned above, click “Weiter(Next)”, then new dialogue box opens, where you can select the type of Message Format as shown in figure below.

After selecting the Message format type, click on “Weiter” and keep pressing next (All defaults options) until finish.
BPEL Process:
Create the empty BPEL Process as shown in figure.

Create Partner Link
Create the partner link and give the reference of WSDL created from Java Code. Select the Role Type as shown in figure.

While creating the Partner link, BPEL process ask for creating the local copy of WSDL, Click Yes (Ja) as shown in figure.

After clicking on Yes (Ja), it will ask for Creating partner link as shown in figure. Click on Yes (Ja).

Now you are ready with the Partner Link. The next step is to invoke the service
Invoking WSIF
Select the Invoke component and then select the desired operation and input/output variables as shown in figure. In my case, “testInit” is operation.

Now you are ready to use the WSIF, the final BPEL Process looks a like

Deployment of Java Classes:
Firstly we have to deploy the BPEL Process along with the WSDL which describes the Java class as web service. BPEL Process requires classes which are referenced by WSIF at runtime, so one way is to place the class files at ORACLE_HOME/bpel/system/classes directory.
Hope it helps…