BPEL for People Sample - The Fifteen Minute Loan Company

This example builds on the basic loan approval tutorial, but now, instead of an automated loan approval web service, we use a People Activity to submit the loan to human loan approvers for a decision.

However, given the speed of business these days, we still need to return a decision very quickly to our customer. The loan approval task is sent to a Logical People Group of loan representatives, but if no user from that group has claimed the task and started work on it within five minutes, the process triggers an escalation which sends a reminder to the group in the form of a Notification. If, after another five minutes, the task has not been completed (i.e. a loan representative has not completed the task), a second escalation is triggered. This second escalation reassigns the task to a specific manager for action. Finally, if the task has not been completed in fifteen minutes, the task expires, returning an error message.

Human activities can take a long time, so a synchronous response to the original request is not expected. When the orchestration determines that a human approval is necessary, it replies immediately to the requester with a response indicating that the loan request is "underReview". After the execution of the human activity, the decision is sent to the loan company Customer Service department, who will then communicate the decision to the customer via telephone or e-mail.


INSTALLATION TOPICS

Archive Files

There are three Business Process Archive (BPR) files in the sample. Other services called by the orchestration are RiskAssessmentService (riskAssessment.bpr), LoanCRMService (loanCRM.bpr), while the sample completed orchestration service itself is named LoanProcessHumanCompletedService (loanProcessHumanCompleted.bpr). Deploy these services by placing the BPR files in the "bpr" subdirectory of your Tomcat installation. Deploying the RiskAssessment and LoanCRM services is necessary to run the sample; the LoanProcessHumanCompleted service is optional, and may be deployed as a completed example of the orchestration.

URN Mapping

The orchestration locates the collaborating services via URNs, so when you deploy these services, you must also define URN Mappings in the Administration console to associate the actual endpoints of the deployed services with the URN. The following URN mappings are required:

urn:x-vos:loancompany:RiskAssessmentService - must map to the deployed RiskAssessmentService (default is http://localhost:8080/active-bpel/services/RiskAssessmentService)

urn:x-vos:loancompany:LoanCRMService (default is http://localhost:8080/active-bpel/services/LoanCRMService)

Both of these mappings can be replaced by a single mapping that has a generic form, and will map all URNS with a similar format:

urn:x-vos:loancompany       mapped to:              http://localhost:8080/active-bpel/services/${urn.4}          

This maps all URNs fitting this pattern to a generic URL pattern, replacing specific entries for each service. This single entry will map all similarly named services without you having to enter a new mapping for each deployed partner service. Use of this generic URN mapping is recommended.

User Definitions for Identity Service

The sample includes, in the "support" directory, a tomcat-users.xml file that includes additional user and user group definitions used in the sample. You can use this file directly by replacing the existing tomcat-users.xml file in the "conf" directory of your tomcat installation, or you can edit your existing tomcat-users.xml file to add definitions to it.

(If you are using the default Designer workspace, with the pre-configured embedded Community Edition ActiveVOS server, then you will see the server's tomcat-users.xml file under the "Tomcat v5.5 Server at localhost-config"  Servers project definition. Overwrite that file with the supplied tomcat-users.xml file in the support directory of the B4P_Sample project.)

Then, at the Administration console, configure the Identity Service to use the XML file. See the Admin documentation for further information about how to do this.


EXECUTING THE SAMPLE

Deploy and configure the services and support files as outlined above. Then log on to the inbox application at http://localhost:8080/aetask using one of the identities defined in the tomcat-users.xml file. There are three loan representative identities, loanrep1, loanrep2, loanrep3, all members of loanreps group; and two manager identities, loanmgr1 and loanmgr2. The sample process sends tasks and notifications to both of these groups as it executes. When signing on the inbox, the password for each identity is the same as the identity itself (e.g. user loanrep1 has password loanrep1).

Using a Web Services Test Client, send a sample LoanProcessRequest message to the LoanProcessHumanService. As the process executes (remember it is all over in fifteen minutes!), you will see the loan review task arriving, followed by notifications and escalations if the task is not completed by the specified deadlines. As a signed on user, you can complete the loan review task by selecting it in the inbox, and filling out the required data.

After the human loan approval activity is completed (or the task expires), the approval result is sent to the loan company Customer Service department via an invoke of LoanCRMService. This service merely issues a notification to one of its customer service representatives using a BPEL4People notification task. These notifications can be viewed by signing on to the task inbox as the customer service rep (user loancsr1, password loancsr1). These are notifications only, and can only be viewed; there are no tasks in the inbox for the CSR to act upon.


INSTALLATION AND EXECUTION STEPS

Archive Files

1. Import the B4P_Sample project into the Designer.
2. Start the embedded Tomcat server in Designer.
3. Deploy the process and related partner services.
4. Create the required URN/URL mappings in the server, as described in this file. The procedure is documented in the Administration Console online help.
5. Enable and test the Identity Service in the server, as documented in Administration Console online help. The supplied default tomcat-users.xml file contains the groups and users assigned to the loan approval task in the B4P Sample.
6. Start the process. Use the tools in the Web Tools Explorer, if desired, as described in the Tutorial topic of ActiveBPEL Designer online help.
7. Open the Inbox, as described in the BPEL for People online help topic, "What is the ActiveBPEL Inbox?".
8. Sign in to the ActiveBPEL Inbox as one of the users described in the tomcat-users.xml file, such as the User Name and Password, loanrep1/loanrep1.
9. Start a task in order to open the Task Details page.



ADDITIONAL INFORMATION

1. Validation at the inbox task detail page.
a. When you are entering data to complete the loan approval task, note that the XSL files that format and format the task data for output, and process the data when it is input, have validation code in them. When you reply with "approved", the Response Reason must be filled in. The value will be rejected if the reason data is not at least 10  characters long.
b. Similarly, if you select "declined", you also need to supply a reason code.
c. This error checking is not required for the process to execute - it was added to illustrate how to do error-checking and similar code snippets when customizing the functionality of the supplied Inbox application.

