Using Email in ActiveBPEL For People
Before completing this part of the sample, refer to ActiveBPEL for People Introduction.
Configuring the ActiveBPEL Enterprise Email Service
To configure your ActiveBPEL Enterprise server to use the email service, perform
the following steps.
- Open the aeworkflow-users.xml file located in the /conf directory of Tomcat.
- Provide email addresses for the users in the aeworkflow-users.xml file. Open the file in a text editor and modify the email attributes for users.
- In the ActiveBPEL Enterprise Administration Console, set up the Email Service
- Configure the Email Service to use the email notification provided in the
sample. Do the following:
- Select Email Service
- Check the Enable checkbox
- Provide the SMTP mail server information including:
- Host
- Port
- Credentials to be used when connecting to the mail server
- Default From address to be used for email sent from the ActiveBPEL email service
- Click Update
Adding an Activity Using Email in the BPEL Process
With the People Activity configured, there is one more optional set of activities to create: the email response to the loan applicant.
To create the email response we are going to use the new email service included with ActiveBPEL Designer. The WSDL file for this is included in the project for convenience, and is located in the /support directory under the ActiveBPEL Designer installation. The steps for creating these activities are:
- Create an invoke activity from the send operation of the emailPLT partnerLinkType. Note: Make sure you use the provided partnerLinkType. This is required for the direct binding option in the PDD wizard.
- Create an assign activity to populate the email request. For this sample we use four copy operations that provide the sendTo email address, email subject line, and email body. The from and replyTo addresses will be picked up from the email configuration. The copy operations are described below:
- Copy the email address - responseEmail - from the Loan Process input message - loanRequest - to the to element of the emailMessage variable
- Use an expression to set the value of the subject
element of the emailMessage variable. The sample uses:
"Loan Application Result"
- Use an XQuery expression that uses values from process variables and html
to create the body element of the
emailMessage variable.
The sample uses the following query:
<HTML xmlns="http://www.w3.org/1999/xhtml">
<BODY>
Dear {data($loanRequest/loanreq:firstName)},<P/>
Your loan request in the amount of <B>{data($loanRequest/loanreq:amountRequested)}</B> has been { data($loanResponse/loanreq:responseToLoanRequest)}.<P/>{ data($loanResponse/loanreq:responseDescription)}<P/>
{if ($loanResponse/loanreq:responseToLoanRequest = "approved") then "Please contact your local branch within 5 business days to complete the transaction. " else "The reason that your loan request is being declined at this time is:"} <P/>
{if ($loanResponse/loanreq:responseToLoanRequest = "approved") then " " else
<p>
{string($loanResponse/loanreq:rejectionReason/loanreq:description)}
</p>}
<P/>
Best Regards,<P/>
Bank Loan Officer<P/>
Visit us online at <A href="http://www.active-endpoints.com">LoansRUs</A>
</BODY>
</HTML> - Use the expression "text/html" to set the mimeType attribute
- Create a link from the People activity to the assign activity that has a transition condition which checks that the email address in the Loan Process input message contains data. The sample uses the transition condition expression indicated below:
- Create an unconditional link from the assign activity to the invoke activity
string-length($loanRequest/loanreq:responseEmail) > 0
Copyright © 2004–2007 Active Endpoints, Inc.
