ActiveVOS Java Integration June 2009
ActiveVOS Service Engine Architecture ActiveVOS Designer and Server provide facilities for developers to integrate Java Objects and BPEL processes BPEL Processes can call methods on Java objects using the POJO (Plain Old Java Object) invoke handler Java objects can invoke processes using the WSIO API XML Receive SOAP Receive WSRM Receive Receive Factory Receive WSIO API ActiveBPEL Service Engine JBI Receive SOAP Invoke Process Invoke BPEL Engine BPEL Process EJB Invoke POJO Invoke Invoke Factory JBI Invoke Java calls Process Process calls Java 2 Confidential Active Endpoints, Inc.
Invoke Java from BPEL Create an Orchestration Project with the Java nature enabled The project src folder or classpath should contain: Java Interface Compile-time dependencies The Java Interface is used to generate WSDL that describes the operations for the Invoke activity A concrete implementation of the Java Interface will be required at deployment and runtime 3 Confidential Active Endpoints, Inc.
Generate WSDL from Java Interface In Designer, right-click on a Java Interface class in the explorer window to generate a new WSDL definition All methods in the Java interface will manifest as WSDL operations All method arguments will manifest as top level XML schema element declarations The method return type will manifest as a top level XML schema element declaration All declared exceptions on the method will manifest as WSDL faults Generated WSDL will include metadata annotations used internally by ActiveVOS (do not remove or modify) Since JAXB is used to generate the schema and bind the objects at runtime, so JAXB rules and limitations apply Rather than use an existing interface directly, you may want to create an adapter interface to wrap calls from the process POJO acts as a thin, stateless adapter layer between process and java code Handles method parameters that do not comply with JAXB rules Throws exceptions that include JavaBean getter/setters to include error details in process faults 4 Confidential Active Endpoints, Inc.
Define a Process that calls Java The generated WSDL can be imported and used to define process variables and activities Method input and output can be manipulated with expressions (XPath, XQuery, etc..) Faults resulting from declared exceptions can be caught and handled 5 Confidential Active Endpoints, Inc.
POJO Invoke Create a new deployment descriptor for the process The Java Service invoke handler will be preselected Browse for (or enter) the implementation class Check the.jar files that will be included on the invoke handler s classpath Deploy to the ActiveVOS server in the normal way 6 Confidential Active Endpoints, Inc.
POJO Invoke When the Invoke activity that was created from our generated WSDL executes, the "pojo" invoke handler will execute and do the following: Get the concrete Java class to invoke (and its classpath) from the PDD information Create a classloader and instantiate the concrete Java class Use the operation name to find the method to invoke on the Java class Extract relevant information from the WSDL Message passed to it Get the operation name Get the part XML element Get a list of all children of the part element Unmarshal the XML for each WSDL message part into Java (using JAXB) Invoke the method If the method has a return value, marshal the return value into an XML element Create a WSDL response message using the XML element from above Return the WSDL response message to the process 7 Confidential Active Endpoints, Inc.
POJO Object State State in the Java objects is associated with a single process instance. Java objects that are used by the POJO invoke handler live as long as the partner link within a process instance. The process will use the same Java instance throughout the lifetime of the partnerlink that uses it. If Class is marked with the Serializable interface 8 Confidential Active Endpoints, Inc.
Call a Process from Java The WSIO API provides mechanisms to dispatch requests into the BPEL engine from Java code On Weblogic, Java clients use the AeMessageQueueBean EJB to interact with the engine Stateless Session Bean There are 2 types of inbound messages Request messages for Receive activities queuereceivedata() Response messages for Invoke activities queueinvokedata() queueinvokefault() 9 Confidential Active Endpoints, Inc.
Queue Data for a Receive The 2 queuereceivedata() methods take 2 parameters Message context - Contains routing information used to dispatch an inbound request to the appropriate process activity Process name Partner Link Operation Message data String[] array containing serialized message part data IAeWebServiceMessageData container 10 Confidential Active Endpoints, Inc.