We proceed as follows to invoke 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:
BookData
and SelectedBookstore
parameters. We will use the appropriate variables for both parameters.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.SelectedBookstoreLocation
string from the output
variable: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):
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.