Version 1.0
     June, 2007
Contents
Introduction
Creating a People Activity
Simulating the People Activity
Run the Application

Using ActiveBPEL for People

Introduction

Before completing this part of the sample, refer to ActiveBPEL for People Introduction. and ActiveBPEL for People Setup.

This step of the sample describes installing and configuring the necessary services as well as creating, configuring, deploying and completing human tasks using the provided ActiveBPEL Task Inbox application.

Requirements

Objectives

Creating a People Activity

Before we start building a People Activity, let's review the scenario we are using for the sample.

Before ActiveBPEL for People

Loan Company A has a Web Site where consumers can apply for loans. A BPEL process takes the requests and does a risk assessment by calling a service that returns the consumer's credit score and then calls another service that applies Company A's rules for approving loans. Currently applications taken in from the Web Site can only be approved or disapproved automatically, as shown in the image below.

Business Requirements for Human Interaction

A major improvement to the current process is to route some of the requests to loan officers. Using ActiveBPEL for People, Company A provides a rules service to determine which requests to route, and sets up the People Activity so that loan officers get the requests and respond to consumers via email.

The requirements are as follows:

The modified process is depicted below.

Modifying the Process

At this point, you can deploy and run the completed process, or you can make the modifications identified in the requirements above. The project files include completed processes with People activities as well as a BPR file. The completed processes are located in the /completedProcess folder and deploying archives are located in the /support/Deploy folder.

To deploy the completed files skip to the deploy section.

To make the modifications yourself, open the LoanRequest.bpel file from the root directory of the project and follow the steps below:

Create the condition for manual approval

  1. In the DecideWhatResponsetoSend If activity, add a new If condition by creating a new ElseIf.
  2. In the condition of the new ElseIf, check to see if the loanRulesResponse states that approval is required for the loan application. Set the ElseIf condition expression to:

    $loanRulesResponse/loanreq:requiresApproval = true()

  3. Add an assign activity with two copy operations that will execute if that condition is true. Note: you can simply copy an existing assign activity and modify the values of the From spec expressions that contain the values to be returned to the applicant under this condition.

Add a conditional assign

  1. From the Palette, select the assign activity and drop it on the canvas below the ReplytoLoanRequest activity.
  2. Rename the activity SetTaskInputData.
  3. Link the ReplytoLoanRequest activity to the SetTaskInputData activity and create a transition condition for the link.

    The transition condition should check that the response from the invocation of the Company's Loan Rules service returned a value indicating that the loan application requires approval. Set the transition condition to:

    $loanRulesResponse/loanreq:requiresApproval = true().

  4. We will add two copy operations to this activity in a later step.

Specify the Location of the Identity Service

There is one final step in configuring ActiveBPEL Designer. You must specify the location of the ActiveBPEL Enterprise Identity Service. To do so, start up the ActiveBPEL Enterprise server. Then in Designer, select Window>Preferences>ActiveBPEL>Identity Chooser. Add the correct host, port, and credential details for your server.

By setting this preference, you are making the aeworkflow-users.xml file available to the People Activity, as we see in the next step.

Add a People Activity

  1. From the Palette, select a People activity, and drop it on the canvas.
  2. Rename the activity CreateLoanApprovalTask.
  3. Link the SetTaskInputData activity to the CreateLoanApprovalTask activity.

Set the properties of the People activity

We will modify properties in each of the People activity's groups The modifications are described in sections below. Note: see completedProcess/LoanRequest.bpel for hints, as needed, to complete these steps.

The Task Access properties provide the people that will administer and work on tasks.

Task Access Property Value Usage
Administrators Set using the Identity Chooser. Select LoanManager. To set the roles or individuals who can perform actions on a task, the easiest method is to use the Identity Chooser option of the Identity Query From spec. Select Identity Chooser from the dropdown list and then the "..." button for the Query. Select Refresh to populate the Identity Chooser with the roles defined in aeworkflow-users.xml.

Potential Owners Set using the Identity Chooser. Select LoanOfficer. See Usage information above for Administrators

The Task Data properties represent the mapping of data between the process and the ActiveBPEL Task Manager application. In addition to message data, access is provided to the task completion information including information on the user that completed the task. This information is important in order to handle common workflow patterns like "Four Eyes" where more than one person is required to review the task before it can be considered complete.

Task Data Property Value Usage
Interface
Set this property prior to any other property in this group.
Select the LoanApproverPortType and the ApproveLoan operation from LoanApprover.wsdl. Defines the interface that is used to describe the task data input and output. To select the interface, you must have the appropriate WSDL added to Web References. In this sample, open the Interface dialog and select Locate. Select LoanApprover.wsdl. Complete the wizard by selecting the existing port type and operation shown in the Value column. As a last step, in the Outline view, modify the namespace prefix from ns1 to loanapprover.
Input Data Mappings
  • Create a new process variable of type Schema Element with a definition of loanreq:loanApprovalRequest
  • Rename the Variable from V1 to loanApprovalRequest
  • Open the Input Data mappings dialog and select the variable loanApprovalRequest for the mapping to the Document part.
Contains the From specs used to initialize the Input message parts for the task. A default Input Data Mapping is generated for each Input Message part of the task Interface operation. Each of these must be completed by selecting a process variable of the same type to populate the task data. In the sample, we need to create a process variable and use that variable for the input mapping.
Output Data Mappings Set as follows:
Mapping 1:
From Output Part: Document
To Variable:loanResponse
Query: $loanResponse
Mapping 2
From Output Part: $taskInfo
Query:aet:taskExecutionState/aet:taskRef
To Variable: loanRequest
Query:loanreq:firstApprovalTaskRef
Provides the ability to map information returned from a task, both task data and output data, to a process variable. Output Data Mappings are optional and follow the same pattern as above. Each Output Message part of the task Interface operation can be mapped to a process variable. In addition you can map task data by selecting $taskInfo as the part name.

The Task Deadline group defines start, completion and expiration deadlines. We will set only the Expiration property. These properties provide the information about any actions that should be taken if a task is either not started or completed in a specified timeframe, as well as an optional task expiration expression that follows the same format as BPEL onAlarms or wait activities.

Task Deadline Property Value Usage
Expiration 'PT24H' The deadline or duration expression that will be evaluated to determine the time at which a expires
Expiration Type Duration A selection of either deadline or duration that determines how the Expiration expression will be validated

The Task Presentation properties provide the information that is used when displaying a task to a user and includes a description of the task, a brief subject line, a name for the task, and a default priority.

Task Deadline Property Value Usage
Default Priority 1 The priority to be set for each new task created
Detailed Description concat( $loanRequest/loanreq:firstName ," ", $loanRequest/loanreq:lastName, " requested a loan of ", $loanRequest/loanreq:amountRequested, " but the credit score of ", $assessmentResponse/loanreq:creditScore ," indicates that a closer review is required" ) Provides a detailed description that is displayed on the Task Detail page of the Inbox
Presentation Name Loan Approval Request The name to be displayed for the task
Subject concat(" $loanRequest/loanreq:loanType , " loan for $", $loanRequest/loanreq:amountRequested, " is pending" ) An expression that provides the information that will be displayed in the Task Inbox list

Complete the SetTaskInputData assign activity

The process is ready to be tested. Although this is a complete process, additional fault handling and escalation would be required to make it a production level application.

Simulating the People Activity

This section is optional. If you're not interested in simulation, you can skip to the next section.

This implementation of ActiveBPEL for People uses standard BPEL activities and special services and bindings to create a robust human interaction capability. This means that the same rules that apply here as they do for simulating any other activity with a couple of additional requirements. There is only one variable for the People activity that is required to have sample data provided, the TaskResultMessage.

The project contains a folder of sample data that is provided to allow you to simulate the execution. There are many samples that you may want to use. Here is a starting set:

Process VariableSample Data File
loanRequestLoanRequest_accepted.xml
assessmentResponse assessmentResponse.xml
loanRulesResponseloanRulesResponse_approvalRequired.xml
TaskResultMessage taskResult_accepted.xml

Deploying the Process into the ActiveBPEL Enterprise Server

Before deploying the process we need to deploy the BPR file that contains the services that are used by the process. Use the Deploy BPR Web page and select the PeopleSupport.bpr file located in the support/Deploy folder of the project.

When you deploy a process that has a People Activity, note that there is no need to create a binding for the People activity's Partner Link. The PDD wizard automatically adds the required entries.

In this sample all the bindings are direct bindings to services that are deployed. Two of the Partner Links use process bindings. LoanAssessorPLT uses the Service name of the CreditCheck process - CheckCreditService - and the LoanRulesPLT binds to the Service name of the LoanRules process - LoanRulesService. For the emailPLT PartnerLink select email in the Invoke Handler.

Finally export the pdd you created or deploy the included LoanRequest.bpr file to ActiveBPEL Enterprise.

Test the Application

To test the process and the ActiveBPEL Task Inbox application, you need to have a Web Service testing tool available. Some of the tools that we use at Active Endpoints include Eclipse WTP, SOAPUI and SOAPSonar which all have free version and products such as XMLSpy Enterprise and SOAPScope. All these tools provide the ability to read in a WSDL from an URL and produce a Web Service request to the specified endpoint. To test the process get the WSDL URL by selecting LoanProcessorPLTService from the Administration Console's Deployed Services page. From there, paste the URL into the testing tool of your choice and once at the form or XML that represents the message fill in the data for the process and submit the message. The path through the process is determined by rules that are defined in the support service BPEL files. The combination of credit score and amount of the loan being requested determines if the loan requires manual approval. The CheckCredit BPEL file applies these rules:

The call to LoanRules BPEL process applies the rules that dictate if a loan application is accepted, rejected or held for manual approval. The rules applied are:

Note: If you have NOT configured the email service you must NOT provide a response email address or the process will fault.

If the response to the Loan Process indicates that the loan is under review, a task has been created for Loan Officers to act on. To act on the task, you sign into the Task Inbox as a Loan Officer. There are three users set up as Loan Officers: loanrep1, loanrep2, and loanrep3. The user name and password are the same. The URL to open the Inbox is: http://[server:port]/aetask

From the Inbox you perform all the actions available for the task, including claim, start, and complete. To add the data that will be used as the response to the process, you need to edit the task and save the data on the Task Detail page.

To show a basic use of the Task Inbox, perform the following steps:

The task will remain in a completed status. In the ActiveBPEL Enterprise Administration Console, verify the process that was started by the request message completed successfully.

Continue to the next part, Using Email in ActiveBPEL for People.