How to invoke Oracle BPEL process from Java?

Thursday, March 22, 2007

Import the following classes.

// To connect to BPEL Process Manager
import com.oracle.bpel.client.Locator;

// To invoke BPEL process
import com.oracle.bpel.client.dispatch.IDeliveryService;

// To process XML messages
import com.oracle.bpel.client.NormalizedMessage;

Add following code to your invokation logic.

1: Connect to BPEL process manager

Locator locator = new Locator("Domain Name", "Pass Word" , "IP Address");

Ex: Locator locator = new Locator("default", "bpel", null);
// null IP address means local server

2: Get the handle of IDeliveryService instance which is used to invoke BPEL process.

IDeliveryService deliveryService =
(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );

3: Prepare the XMl message for input.

String xmlData = "XML data";
NormalizedMessage message = new NormalizedMessage( );
message.addPart("payload", xmlData );

4: Invoking BPEL process with two way operations
(which has both input and output messages)

NormalizedMessage res =
deliveryService.request("BPEL Process ID", "Operation Name", "message");
Map payload = res.getPayload();

5: Invoking BPEL process with one way operations
(which takes input message but returns not output)

deliveryService.post("BPEL Process ID", "Operation Name", "message");

  © Blogger templates Newspaper by Ourblogtemplates.com 2008

Back to TOP