Monday, April 28, 2008

Including Task History from Previous Task in Oracle BPEL Human Workflow


Oracle BPEL allows the use of Human Task process activities, in conjunction with the Oracle Worklist Application, to allow human interaction with BPEL processes.

Sometimes, it would be desirable to have two human flows that include the same information. Consider a purchase request -- such a request may have a management approval flow, and then a flow for the purchasing department to actually obtain the item. If any comments or attachments are added during the management flow, the purchasers will probably need to see them.

The advanced tab of the human task process has a check box for including the task history from a previous human task process. Unfortunately, as of this writing, JDeveloper (10.1.3.3) does not correctly generate the BPEL copy operations for the new process. Compiling the process will generate several (usually 2 or more) errors relating to invalid XPATH expressions.

The problem usually lies in the copy blocks just prior to or just after the invoke for the new process. For example, the following code might be generated:

<copy>
<from variable="reinitiateTaskResponseMessage" part="payload"
query="/taskservice:initiateTaskResponse/wfcommon:workflowContext"/>
<to variable="workflowContext" query="/wfcommon:workflowContext"/>
</copy>

The problem here lies in the fact that the query should be changed to look like:

<copy>
<from variable="reinitiateTaskResponseMessage" part="payload"
query="/taskservice:reinitiateTaskResponse/wfcommon:workflowContext"/>
<to variable="workflowContext" query="/wfcommon:workflowContext"/>
</copy>

Notice, that the only change required was from initiateTaskResponse to reinitiateTaskResponse. That will be true for all of the errors, and by simply inserting a 're' you can fix them all.

One final note is that its easier to pick these out using the source editor view than the graphical view.