Time for action – invoking a human task from the BPEL process

We proceed as follows to invoke a human task from the BPEL process:

  1. To invoke the human task, we simply drag Human Task from the SOA Components palette and drop it in the appropriate place in the BPEL process.
    Time for action – invoking a human task from the BPEL process

    We have decided to place it at the end of the BPEL process, after the <if> activity and before the callback <invoke> activity:

    Time for action – invoking a human task from the BPEL process
  2. Next, we will double-click on the human task and a dialog for human task configuration will open. Here, we will select the BookstoreApproval human task definition:
    Time for action – invoking a human task from the BPEL process
  3. We can skip Task Title (in which case the default task name will be used) and proceed straight to Task Parameters. We need to provide the BookData and SelectedBookstore parameters. We will use the appropriate variables for both parameters.
  4. For BookData, we will use the BPEL variable with the same name—BookData. As this variable does not exist yet, we need to create it. Refer to Chapter 3, Variables, Data Manipulation, and Expressions, for variable creation. The BookData variable should use the XML element BookData from the BookWarehousingBPEL.xsd XML schema. We also need to assign the values to the BookData variable, which we should do in the corresponding <assign> activities: AssignBookstoreA, AssignBookstoreB, and AssignAnotherBookstore respectively.
  5. For SelectedBookstore, we will use the SelectedBookstoreLocation string from the output variable:
    Time for action – invoking a human task from the BPEL process

What just happened?

We have successfully invoked the human task from the BPEL process flow. The human task does not differ considerably from a service invocation. Similarly, as for a service invocation, we needed to provide the parameters for the human task. In our case, we have defined two parameters, BookData and SelectedBookstore. We have obtained the data from the BPEL process variables.

We can look closer into the human task invocation and we will see that it is a structured activity, which asynchronously invokes the BookstoreApproval service (the human task service):

What just happened?

Configuring human task case branches

Next, we need to configure the human task case branches. We remember that we have defined the possible outcomes of the human task. In our case, we have defined the APPROVE and REJECT outcomes.

Therefore, we need to specify, in the BPEL process, what the process will do if one of the outcomes is selected by the user. Additionally, we also have to specify what happens if the human task outcome is not defined. This could happen if the human task expires, if it is canceled, or if an error occurs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.169.78