For my last project we had to get access to the HumanWorkflow Tasklist that was created and maintained by Oracle BPEL 10.1.3.1. For this purpose BPEL comes with an API that should be used. However, for the latest release there isn’t very much documentation about it. After searching the internet I ended up in this thread of the BPEL forum.

So that’s why I decided to make this blog so other people running into problems with the API can use this code as a headstart.The project (which can be downloaded here: project.zip) was tested with JDeveloper 10.1.3.1.0 and a running instance of Oracle’s SOA Suite 10.1.3.1.0. The code uses the REMOTE_CLIENT option to connect to the BPEL instance. The BPEL instance is running on a machine called ‘pascal-laptop’ and I have set the RMI port for the OC4J instance to 12401. All other settings are defaults. When you open the project you will see a file called ‘wf_client_config.xml’. This file configures the location where the client can find the BPEL server and it’s services. You most likely will have to change this file to make it match your configuration.

If you are running into a ‘NoClassDefFoundError’ you have probably an error in the ‘wf_client_config.xml’ file. You should also check the libraries I have defined at the project, to make sure the used paths are all valid.

Now back to the sample code:

  • The tasklist that is created will show ALL tasks in your BPEL instance. You would probably want to filter those. First of all you can replace ITaskQueryService.ASSIGNMENT_FILTER_ALL with ITaskQueryService.ASSIGNMENT_MY_AND_GROUP so only tasks that are assigned to the user logged in and/or his group are shown.
    Furthermore you can use the method getFilter(…) to create a custom filter that filters the output.
  • Another thing I want to mention is the authenticate method. The authentication is now done with the oc4jadmin user. You can use the fourth parameter to ‘log in’ on behalf of another user. If I created a user ‘palma’ and supply this as a parameter I will only see the tasks of the user ‘palma’ and his group. We use this construction in our application. We extract the username from the authenticated session of the web-application and supply it with the authenticate method so only the tasks of that webuser (and his group) are shown.
  • My final recommendation is, since the authentication is a rather ‘expensive’ method, when you have obtained a HumanworkflowContext to store it in your session context, so you can take it from there instead of authenticating yourself for each ‘query’.

I hope this blog and sample code helps. Please let me know what you think of it!