Sunday, June 23, 2013

Calling ADF BC Web Service from BPM Process

This post is about calling ADF BC Web Service from BPM Process. In order to keep track of the steps executed in the process I will be calling ADF BC Web Service, passing task outcome and updating database table. This is quite handy, especially when identifying and recovering failed BPM process instances. You could implement process instance replay, when process instance execution data is stored in the DB. For this purpose I will pass process instance ID to the ADF BC Web Service in order to identify and assign current process task.

Run sample application - adfbpmapp_ps6_v3.zip and start new process:


We can see from BPM log - first task is completed and call to ADF BC Web Service is executed:


Same can be visualized in the process flow:


Database is updated through ADF BC Web Service with current process instance ID, payload ID and task outcome - started:


Push task further by submitting it for approval:


This will be visualized in the process flow - invoking status update through ADF BC Web Service and arriving to approve employee task:


Database is updated for the current process with the task executed set to be assigned:


Let's reject this task now:


Process flow comes back to original assigning task:


This is logged in the DB - status reject:


Start new task and you will see that record with new process instance ID will be created, assigned with different status:


Finally if first process instance gets approved:


We can see this updated in the DB - status approve:


This was quick description about how such functionality works, now I will describe important things from technical perspective.

First issue you will encounter when calling ADF BC Web Service from BPM process - Data Source driver compatibility. By default ADF BC is using non-XA data source driver, however this should be changed when calling ADF BC from BPM process. If you would use default non-XA driver, there will be error generated related to transaction failure and driver type:


Go and declare second driver for your ADF application, now XA type driver:


Make sure you select it for the application module configuration serving ADF BC Web Service:


ADF BC Web Service method itself executes View Criteria to search for process instance ID. If such ID was already logged, it updates the record, if not - creates new record:


Here we can see custom method from Application Module Implementation class exposed as ADF BC Web Service method:


Make sure to set additional listener class in weblogic.xml of ADF BC Web Service application, otherwise ADF BC Web Service method will not be located from BPM process. Add this listener - oracle.jbo.client.svc.ADFApplicationLifecycleListener:


You need to copy ADF BC Web Service WSDL URL and use it in BPM process to define service call:


Here you can see ADF BC Web Service invocation service call defined in BPM process:


Very important is to set correct Registry property for the service call defined on top of ADF BC Web Service. Registry property must start with ADF BC Web Service deployment application name and end with JBOServiceRegistry system keyword (there must be _ between these two).

ADF BC Web Service payload values are initialized through data association. Process instance ID is set from predefined BPM process variable - ecid:

2 comments:

  1. Hi Andrejus,

    A year ago we had a problem with using ADF Application with XA Driver on weblogic 10.3.6. You only advised me not to use XA Driver with ADF Application as XA driver is not supported with ADF.
    Did you see any issue with XA Driver in your current ADF Application?

    ReplyDelete
  2. These are different things. Yes, XA driver is not supported generally by ADF web apps. In this example, I'm using ADF BC Web Service and when invoked from BPM it doesnt work with regular driver, this is the reason using second driver with XA type for such Web Services.

    Andrejus

    ReplyDelete