Calling into the Oracle BPEL Engine from Java
We have discussed in several previous posts how you invoke Java services from BPEL processes, either through embedded Java or through a WSIF interface. Another interesting option with the Oracle BPEL Engine seems to be that only does it allow you to call out from a BPEL process to Java based services, but also the other way round: through a Java API you can initiate processes in the BPEL engine, as well as check their progress. See for an example: Initiating a BPEL Business Process using a Java UI.
The tutorial BPEL Tutorial Tutorial 7: Invoking BPEL Processes through SOAP and Java on OTN also demonstrates how you can invoke a process in the BPEL Engine from Java: Processes can be invoked programmatically via a Java API provided through a stateless session bean interface by the BPEL Process Manager. The API is slightly different depending on whether you are invoking a two-way operation (which has both input and output messages) or a one-way operation (which just has an input message and returns no result). Most examples assume that the Java code invoking the BPEL engine is run locally, in the same JVM as the BPEL engine. Then it states that such needs not be the case:
Using the Java API from a Remote Client
The code examples as described above are executed within the same application server container as the BPEL Process Manager is running in. These APIs are remotable, however, and can be used via RMI from a remote application server. We do not currently ship code examples for this use-case – in part because the RMI client code is different based on which application server the client is running in. You should work with your Oracle support representative regarding how to use the BPEL process Manager Java API over RMI for your specific client configuration/environment.
Excellent contents can be found in the Preview from Business Process Execution Language for Web Services” by Packt Publishing., Chapter 4 Oracle BPEL Process Manager (62 pages),see also the website http://www.bpelbook.com/. This book illustrates all major components in Oracle BPEL Process Manager, including Design, Deployment, Administration, the Oracle BPEL enhancements over standard BPEL, the Email and the JMS adapter and the Java integration. It provides some clear examples.
Until now we have discussed how to develop, deploy, and manage BPEL processes on the Oracle BPEL Process Manager. We have also discussed how to integrate BPEL with Java resources. In complex real-world scenarios we may also need to access the BPEL Server functionalities. For example, we might want to develop our own console through which users could monitor active processes, start new process instances, set the priorities, etc. We might also want to integrate user tasks with BPEL processes.
To realize these requirements, BPEL Server provides access to its functionality through a set of APIs. As the Oracle BPEL Server has been developed in Java, these APIs are packages for use by developers. Using them we can develop our own applications that interact with the server and provide information about the state of the process instances, enable their management, and provide other useful information. Oracle provides Javadoc files to help learn how to use these APIs. The BPEL Console also uses these APIs and the source code is provided (a set of JSPs). Developers can use it to learn how to use the APIs.
Calling from Oracle Forms and/or PL/SQL
One of the possibilities that is opened up through the Java API of the Oracle BPEL engine, is the option to create a Java Class that makes that call and subsequently import that Class into Oracle Forms or, as Java Stored Procedure, into the Oracle database. In both cases, we can wrap the class and invoke it from either a Program Unit in a Form or a PL/SQL package in the database. Integration between Oracle Forms en Oracle BPEL PM is described in an article in Oracle Magazine of March/April 2005: Oracle Forms in the SOA World, by Robin Zimmermann – Oracle Forms can be part of your service-oriented architecture.