Mythics Blog

Programmatically Set Oracle BPM Instance Payload Values

Posted on July 31, 2013 by Bill Wallen

Tags: Mythics Consulting, Oracle

Use Case

A Use Case that I have commonly encountered during Oracle Business Process Management (BPM) projects involves exposing an initiable human task through a front-end portal. The User will click on a link that displays an initiable human task form from a process. Then, the User will enter some information and save/submit the form. The major advantage to this approach is that all interaction with the instance occurs within the context of the BPM engine. The biggest disadvantage is, perhaps, that this approach requires custom development. So how do we develop this solution?

Solution

The following steps detail how to create a BPM instance from an initiate task and display the human task form.

  • Obtain a BPMServiceClientFactory using wf_client_config.xml
  • Obtain an IBPMServiceClient from the factory
  • Obtain an IBPMContext from the factory
  • Obtain an initiable process using the context and serviceClient
  • Create a task using the context and initiable process
  • Obtain an IWorkflowServiceClient from the factory
  • Use the workflowServiceClient to query for the initiated task
  • Obtain and modify the payload element in the initiated task
  • Obtain an ITaskService to persist the values of the payload element to the initiated task
  • Get the URL of the human task form
  • Clean up

Prerequisites

Below are the prerequisites to complete this solution with JDeveloper and BPM.

  • JDeveloper 11.1.1.7 is installed.
  • The SOA and BPM extensions are installed.
  • A BPM process that contains an initiable process has been built.
  • BPM 11.1.1.7 is installed, configured, and running.
  • A process has been deployed to the BPM engine.
  • Access to the process role that will allow a user to initiate a process has been granted to a user.

How-To

The process for obtaining a factory has changed slightly in BPM 11.1.1.7, as additional libraries are now necessary to make a connection to BPM. Specifically, a Case Management library and a Metadata library are necessary, else the code will throw a compile-time exception. Create a generic application and add the following references as dependencies:

  • BPM Workflow (library)
  • Oracle XML Parser v2 (library)
  • JPS Designtime (library)
  • oracle.bpm.bpm-services.client.jar ($MW_HOME/jdeveloper/soa/modules/oracle.bpm.client_11.1.1)
  • oracle.bpm.casemgmt.interface.jar ($MW_HOME/jdeveloper/soa/modules/oracle.bpm.runtime_11.1.1/oracle.bpm.casemgmt.interface.jar)
  • oracle.bpm.metadata.jar ($MW_HOME/jdeveloper/soa/modules/oracle.bpm.runtime_11.1.1/oracle.bpm.metadata.jar)
  • wsclient_extended.jar ($MW_HOME/oracle_common/webservices/wsclient_extended.jar)
  • wlfullclient.jar (build instructions)

Next, create an xml file called wf_client_config.xml in the Application Sources directory. The file must reside here. Expand the code below to see an example wf_client_config.xml.

The following code is an example implementation of programmatically creating a BPM instance, manipulating the payload values, and obtaining the URL for the human task associated with an initiable process activity.

References

BPM 11g API examples
BPM 11g API

A complete download of a working example including a process, a process UI, and the instance creation class, can be downloaded from bitBucket.

Comments

  • ! No comments yet

Leave a Comment