Saturday, April 20, 2013

Oracle BPM 11g Mobile Worklist with ADF Mobile

I have developed ADF Mobile application to bring BPM worklist tasks to the mobile device - I would like to share concepts of such ADF Mobile application with the community. The whole idea is based on BPM Java API to access BPM Context and get currently assigned tasks for the user, read more here - Lightweight ADF Task Flow for BPM Human Tasks Overview. Once tasks from BPM are queried, they are exposed through ADF BC secured Web Service method. Web Service is consumed from ADF Mobile application through Web Service Data Control - task data is rendered on the mobile device, later user can do callback and send approve/reject actions. Approve/Reject actions will be processed by BPM API on ADF BC secured Web Service side.

ADF Mobile login and secured Web Service call implementation is done based on previous blog - ADF Mobile - Secured Web Service Access.

Here you can see BPM mobile worklist solution high level architecture:


Sample application - BPMMobileWorkListApp.zip, is shipped with three separate JDeveloper applications:

1. ADFBasicAuthApp - server side application to allow login into ADF Mobile application running on the mobile device

2. ADFSecuredService - server side application with access to BPM context and exposed secured Web Service providing list of tasks for the current user

3. ADFMobileSecuredApp - ADF Mobile application with connection to secured ADF BC Web Service, displays BPM mobile worklist

User is provided with login screen for BPM mobile worklist application:


Here we can see standard ADF Worklist task flow running in the Web browser with BPM tasks listed. The same tasks are listed in BPM mobile worklist:


In BPM mobile worklist user can select particular task and view details:


1. ADF BC secured Web Service Implementation

ADF BC secured Web Service is implemented and deployed based on this post - Web Service Interface for ADF BC Application Module in Oracle Fusion 11g.

Web Service method returns List type, each task data is represented with one line in the list. Method is exposed through ADF BC Web Service, return type - List:


Connection to BPM context is established with the username retrieved from ADF Security context, password is static for the simplicity of the example:


Sample application contains logic to access BPM context and retrieve all pending tasks for current user. Tasks are collected and returned as List:


Such Web Service can be tested from Oracle Enterprise Manager, using OWSM policy for secured access. See list of task data returned:


2. ADF Mobile application for BPM mobile worklist

Secured Web Service is consumed in ADF Mobile and Data Control is created:


Data is loaded into mobile device screen through proxy Data Control bean - WorkList, in this bean we do parsing of Web Service data retrieved from MobileService Data Control:


Here is the source code for BPM mobile worklist screen - list of tasks:


Screen to display details of BPM task in ADF Mobile:

14 comments:

Sureshbabu Rajendiran said...

Hi Andrejus,

Instead of using the API and then exposing it as secured web service.. why don't we use webservice exposed for worklist directly?

http://biemond.blogspot.in/2012/04/how-to-use-human-workflow-web-services.html

Let me know any drawbacks using it?

Regards,
Suresh

Andrejus Baranovskis said...

Hi,

Accessing Web Service from Human Task is good also. But in my experience, in practice it makes it easier to publish your own Web Service and isolate access to BPM through Java API. This allows to control entire solution in more transparent way, centralized into server side API.

Other thing, you may hit a bug with out of the box Human Task Web Service and as it happens it will be much harder to workaround it comparing to your own Web Service.

With API it is easier to implement data caching in between.

Andrejus

Sureshbabu Rajendiran said...

Hi,

How to get the username and password to get the intial workFlow context...

Without getting logged-in user's context this doesn't looks like a working solution.

Kindly let me know your suggestions on this ...


Regards,
Suresh

Andrejus Baranovskis said...

Hi,

As you can see in sample app, I'm getting username dynamically from ADF Security Context. Regarding password - you need to get it from your enterprise security management system.

Andrejus

Sureshbabu Rajendiran said...

Thanks Andrejus..

Could you please throw more light on how to get password from enterprise security management system or some docs pointing to it.

Regards,
Suresh

Adam Quan said...

Is it possible for you to give a step-by-step instruction on deploying and connecting this application to a running BPM environment?

Anonymous said...

Hi,

How to handle the approve/reject part through mobile?

Pedro said...

Hey Andrejus,
My ADF Secured APP runs fine and I'm able to display the tasks from my SOA Server on the table with the RetrieveBPMTasks method.
But I'm having a problem when I create the WS on service interface. I can't invoke the RetrieveBPMTasks method...gives me " Exception while executing the business logic: Timeout during commit processing
"
From my logs, the implementation is good and it is running out of problems, but after it ends, the WS keeps executing I don't know why.(Also increased timeouts and it didn't work)
Thanks

Anonymous said...

Hey Andrejus,

First of all, thanks a lot for the awsome tutorials...this is helping me alot!

I got a small question, since I'm new to ADF, after invoking the WS as Data Control on the mobile, whats the next step for separating the String into a java class?

I understand what the Worklist java class does, and that after u just create a data control of it. I just don't know where did the Task.xml came from...

Next steps are creating 2 classes(task and worklist) and generating data control of worklist?

Thanks alot again!

Andrejus Baranovskis said...

Task.xml is auto generated, you can generate it from Data Control.

Andrejus

Anonymous said...

Thanks a lot for your super fast answer...
I did every step, but I can't seethe tasks on my mobile, and I think I know what the reason is, despite the weak error message.
On my mobile appears a red error box saying "retrieveBPMWorkLislTasksWithKey".
Yeah, my method as an aditional "with key" because I'm using 2 atributes as parameters to use on the query...the problem should be coming from there right?
Do I need to change this here to had the parameters?(can't find much help on internet):
MethodExpression me = AdfmfJavaUtilities.getMethodExpression("#{bindings.retrieveBpmWorklistTasksWithKey.execute}", null, new Class[] {})

Thanks again for your patience

Andrejus Baranovskis said...

In ADF Mobile, you could call a method from Data Control directly, even without registering it in the bindings. I'm explaining it with example in my latest post here: http://andrejusb.blogspot.de/2014/08/transactional-data-caching-for-adf.html

Andrejus

Anonymous said...

Hmm, sorry if this is too obvious, but I can't understand. I don't want to implement data caching, I just need to transform the String result into diferent atributes using the java bean.
As I saw in your blog, you were doing this to invoke the Data:
MethodExpression me = AdfmfJavaUtilities.getMethodExpression("#{bindings.retrieveBpmWorklistTasksWithKey.execute}", null, new Class[] {});
GenericType result = (GenericType)me.invoke(AdfmfJavaUtilities.getAdfELContext(), new Object[] {});

Since my method got 2 params, I probably got to change something here no? Or do I need to use the invokeDataControlMethod?!

Thank you so much ;)

Andrejus Baranovskis said...

Yes, I don't mean to implement data caching - I'm saying you can find an example in caching blog, about how to call a method and pass parameters.

Andrejus