Monday, May 17, 2010

Invoke BPEL using Java API

This article helps you in kick start of creating your own BPEL console or automate program to do certain activities which BPEL console can perform.

All the operations performed in BPEL console can be created using the java API.

BPEL processes can be invoked using a Java API. The API will differ depending upon the type of operation involved. One way operation has an input message without result. Two way operations send and receive the message.

Refer Java API : http://download.oracle.com/docs/cd/B31017_01/integrate.1013/b28986/toc.htm

Note: orabpel.jar files should be added in the classpath


package com.bpel.client;

import com.oracle.bpel.client.*;
import com.oracle.bpel.client.dispatch.*;

import java.util.Map;
import java.util.Properties;


public class InvokeBPEL
{

/**
*
* @author Ziaur Rahuman S
*/
public static void main(String[] args)
{

Properties props = new Properties();

props.setProperty("orabpel.platform", "ias_10g");
props.setProperty("java.naming.factory.initial",
"com.evermind.server.rmi.RMIInitialContextFactory");
props.setProperty("java.naming.provider.url",
"opmn:ormi://hostname:6003:oc4j_soa/orabpel");
props.setProperty("java.naming.security.principal", "oc4jadmin");
props.setProperty("java.naming.security.credentials", "oc4jadm1n");
props.setProperty("dedicated.connection", "true");


String xml = "<SyncHelloWorldProcessRequest><input>World</input></SyncHelloWorldProcessRequest>";

try {
// Create instance of Locator object with domain name and password as arguement
Locator locator = new Locator("ocoetest", "oc4jadm1n", props);
IDeliveryService dService = (IDeliveryService) locator.lookupService(IDeliveryService.SERVICE_NAME);

// Create normalized message with payload
NormalizedMessage nm = new NormalizedMessage();
nm.addPart("payload", xml);

// Invoke two way operation
NormalizedMessage response = dService.request("SyncHelloWorld","process",nm);
Map payload = response.getPayload();

// Invoke one way operation
//dService.post("AsyncHelloWorld","initiate",nm);

System.out.println("SyncHelloWorld Invoked Successfully !!!");

} catch (Exception e)
{
e.printStackTrace();
}


}
}


Friday, May 7, 2010

Different ways of deploying BPEL process

BPEL process can be deployed in different ways. This article will show the different possible way of deploying the BPEL process.


1, Deploy using JDeveloper


It’s the regular deployment using the jdeveloper by selecting the deploy option in the bpel process as shown in the below screen shot.










2, Deploy using BPEL Compiler


1, Open command prompt

2, set oracle bin path (set PATH=C:\oracle\bpel\integration\orabpel\bin;%PATH%)

3, C:\>bpelc -rev 1.0 -deploy default C:\oracle\bpel\integration\jdev\jdev\mywork\D

emoWS\HelloWorld\bpel.xml

Syntax:

bpelc (BPEL Compiler) (<SOA_HOME>\integration\bin> bpelc –rev[ver no] –deploy [domainname] <Path of the bpel.xml>













3, Deploy using OBANT


1, Open command prompt

2, set oracle bin path (set PATH=C:\oracle\bpel\integration\orabpel\bin;%PATH%)

3, Navigate to BPEL process directory, where the build.xml file resides(ex: C:\oracle\bpel\integration\jdev\jdev\mywork\DemoWS\HelloWorld)










4, Deploy using BPEL Console


1, Open BPEL Console

2, Click BPEL Process tab -> Deploy New Process link

3, Browse to the BPEL process jar file and click deploy













5, Deploy by placing the jar in deploy folder


Above 4 scenarios’ of deployment works for 10.1.2 and 10.1.3 versions of BPM. This scenario of copying the bpel jar file will work only for 10.1.3 and above versions.

1, Copy the jar file into <BPEL_HOME>\integration\orabpel\domains\default\deploy folder.

2, Check <BPEL_HOME>\integration\orabpel\domains\default\tmp folder, created with the copied bpel suitcase.