Thursday, July 3, 2008

more on BPELProcessHandle class

In one of my previous blogs on invoking BPEL from java using RMI I had mentioned the different classes used to connect to the BPEL process.

As you know Locator class helps you to connect to bpel domain. Once you have the Locator instance the BPELProcess instance can be accessed using the lookup service method by giving the bpel process Id.

For example I created a BPElProcess named SensorTest and deployed it.

// code on how to create a locator instance have been explained in my previous blog on RMI

IBPELProcessHandle bpelProcess = locator.lookupProcess("SensorTest");

IBPELProcessHandle is the reference which will represent the process.

To view what all sensors are associated with the particular process- in this case SensorTest

System.out.println("sensors:\n" + bpelProcess.getSensorDefinitions());

System.out.println("sensor actions:\n" + bpelProcess.getSensorActionDefinitions());

Output will look like following

sensors:

<sensors xmlns="http://xmlns.oracle.com/bpel/sensor">

<sensor sensorName="sensor_recieve" classname="oracle.tip.pc.services.reports.dca.agents.BpelActivitySensorAgent" kind="activity" target="receiveInput" xmlns:client="http://xmlns.oracle.com/SensorTst1" xmlns:pc="http://xmlns.oracle.com/bpel/sensor" xmlns:tns="http://xmlns.oracle.com/ SensorTest ">

<activityConfig evalTime="activation"/>

</sensor>

<sensor sensorName="VariableSensor_1" classname="oracle.tip.pc.services.reports.dca.agents.BpelVariableSensorAgent" kind="variable" target="$outputVariable/payload/client:SensorTestProcessResponse/client:result" xmlns:client="http://xmlns.oracle.com/ SensorTest " xmlns:pc="http://xmlns.oracle.com/bpel/sensor" xmlns:tns="http://xmlns.oracle.com/SensorTest">

<variableConfig outputDataType="string" outputNamespace="http://www.w3.org/2001/XMLSchema"/>

</sensor>

</sensors>

sensor actions:

<actions xmlns="http://xmlns.oracle.com/bpel/sensor">

<action name="reply_sensor" publishName="" publishType="Custom" enabled="true" filter="" publishTarget="com.geo.SensorLogger" xmlns:pc="http://xmlns.oracle.com/bpel/sensor" xmlns:tns="http://xmlns.oracle.com/ SensorTest ">

<sensorName>sensor_reply</sensorName>

<sensorName>VariableSensor_1</sensorName>

</action>

</actions>

To view SOAP location of the particular process-

System.out.println("SOAPLocation:\n" + bpelProcess.getSOAPLocation());

To view the list of errrors

System.out.println("errors:\n" + bpelProcess.getErrors());


Try out and see for yourself :)

No comments: