ActiveBPEL® Designer User’s Guide

Tutorial Part 5: Adding Process Activities and Properties

You have now completed:

In the Project Explorer view, you should have the following:

By completing Part 5 of the tutorial, you will be able to:

Step 1: Use the Outline view to add and select building blocks

The Outline view displays all major components of a BPEL process. The Outline view shown on the left is the default for a new process, containing only the parent nodes. Your Outline should look like the one on the right. By starting your process using Interfaces, you have automatically added the appropriate namespace, partner links, variables, and several activities.

Outline view default view

Outline view with items added view the operation  wizard

  1. In Outline view, select Correlation Sets.
  2. Click and hold the Correlation Sets node, drag it to the bottom of the outline, and move it slightly until you see a black bar, indicating you can drop it. The loan approval process does not include any correlation sets, so you can move this node out of the way.
  3. Drag and drop outline node

    Tip: You can move items up and down to reorganize them. You can right-mouse click on a node to add new items of the same type.

Step 2: Rename a Namespace Prefix

Each WSDL and schema file declares one or more namespaces that provide a context for messages, port types, and other definitions. The namespaces that are declared in the schema and WSDL files that your process references must also be declared in the process itself.

Because one namespace can have many WSDL files associated with it, ActiveBPEL identifies the correct WSDL file by using the Imports function. The Operation wizard automatically added the import, and added a default namespace prefix, which you can rename to make it more meaningful.

  1. In Outline view, expand Imports to see the location of the WSDL.
  2. Imports node of Outline view displaying WSDL location and namespace

  3. Expand Namespaces and notice the new namespaces. The loan prefix and the loanmsg prefix are two of the namespaces the Operation wizard added.
  4. The wizard checks for namespace prefixes declared in WSDLs and adds them to the process. The loanProcess.wsdl declares loan for the loanRequest.xsd URI and loanmsg for loanMessages.wsdl URI.

  5. It is a best practice to give meaningful prefix names, if they are not already declared. In the Properties view, type loanprocess in the Prefix field to provide a shortcut for the loanProcess.wsdl URI.
  6. Rename the two other namespace prefixes, as follows:
  7. WSDL name

    New Prefix

    riskAssessment.wsdl

    riskws

    loanApproval.wsdl

    approvews

  8. Your list of namespace prefixes should match the following:
  9. WSDL/XSD name

    Prefix

    loanRequest.xsd

    loan

    loanProcess.wsdl

    loanprocess

    loanMessages.wsdl

    loanmsg

    riskAssessment.wsdl

    riskws

    loanApproval.wsdl

    approvews

Tip: All new processes contain two common namespaces. The xsd namespace defines the location of the XML schema. The bpel namespace defines the location of the BPEL schema.

Step 3: Use a Shortcut to Automatically Create an Assign Activity

There are two more activities the process needs: Assign activities. In the loan approval process, the assessor must assign an approve or deny message to be sent in the Reply to the loan requestor. An Assign accomplishes this through a Copy Operation.

Within the Process Variables view, you can create a Copy Operation automatically. The Copy Operation copies a literal value to the approval message.

  1. Display the Process Variables view, which is stacked next to Interfaces.
  2. Right-mouse click the approval variable, and select Open.
  3. Right-mouse click the approval message, and select Copy> To, as the illustration shows.
  4. Note: The Copy >To option means create the TO side of the Copy Operation.

    Context menu for process variable part

  5. In the Copy Operations dialog, complete the FROM part as follows:
    1. Select Literal from the Type list.
    2. Select the XML Builder button.
    3. In the Preferences dialog, notice that the matching data type, loanApprovalResponse, is selected as the Root Element. The element-based approval message is a single part element.
    4. Select Finish. Your Copy Operation should look like the following example:

    Copy Operation dialog

  6. This response will be the “loan approved” response from the Invoke Loan Approver, so we can edit the placeholder string value in the <loan:responseDescription> element with the following:
  7. Click OK, and you will see a new Assign activity in the Process Editor. The activity is in the upper left corner.
  8. Move the Assign below the Invoke Loan Approver.
  9. Rename the Assign as AssignApprove.
  10. Click anywhere on the Process Editor canvas to deselect the Assign before proceeding to the next step (and see the Tips below Step 11.)
  11. Create a second Assign activity for the “loan denied” response as follows:
    1. Select the approval variable and select Copy> To.
    2. Using the XML Builder in the Literal Contents field, create a literal FROM assignment with the following literal contents:
    3. <loan:loanApprovalResponse xmlns:loan="http://schemas.active-endpoints.com/sample/LoanRequest/2008/02/loanRequest.xsd">
        <loan:responseToLoanRequest>
           declined
        </loan:responseToLoanRequest>
        <loan:responseDescription>We
      are sorry,
             this
      application falls outside of our
             credit
      risk guidelines.
        </loan:responseDescription>
        <loan:rejectionReason>
           <loan:reason>lowCredit</loan:reason>
           <loan:description>low
      credit score
           </loan:description>
        </loan:rejectionReason>
      </loan:loanApprovalResponse>
    4. Name the new Assign activity AssignDeny.
  12. Your process should look like the following illustration.

Two Assign activities added

Tips: Be sure to move and deselect the first Assign activity before creating the second one. New Assigns created from Process Variables are always added to the upper left corner of the canvas. If you did not create two Assigns, double-click the first one to see if you created two Copy Operations within it.

Step 4: Add Links for Sequencing Activities

Depending on the loan amount in the request, either the loan assessor’s Web service or the loan approver’s Web service is invoked. Our process implements this logic by linking the Receive to both Invokes. Since the sequence is conditional, a transition condition will be added to both links in Step 5.

  1. Select the Receive activity, and shift + select InvokeRiskAssessor.
  2. Select the Link toolbar icon or select Link Activities from the right-mouse menu.
  3. Select the link to put the Properties view in focus. Type in the Link Name field, receive-to-assess.
  4. Repeat Steps 1-3 to create a link from the Receive to the Invoke Loan Approver activity, naming the link receive-to-approve.

Step 5: Add a Transition Condition to Links

  1. Select the receive-to-assess link in the Process Editor.
  2. Double-click the link.
  3. In the Transition Builder dialog, double-click the amountRequested part of the creditInformation variable to add the appropriate expression to the Transition box.
  4. Complete the expression by selecting the “less than” operator and typing in 10000, as shown in the following example. Click OK.
  5. Transition Condition Builder dialog

  6. For the receive-to-approve link, add the expression as follows:
  7. $creditInformation/loan:amountRequested >= 10000

Step 6: Add links and link transitions for the InvokeRiskAssessor and InvokeLoanApprover

The Loan Assessor returns a result of review, high risk, or low risk for the customer. Build the links and transition conditions as follows:

  1. Add a link from Invoke Risk Assessor to Invoke Loan Approver.
  2. Name the link assess-to-approve.
  3. Add a link transition for a high risk condition by creating the expression $riskAssessment/loan:riskAssessment = 'review'
  4. Add a link to each Assign activity from the Invoke Risk Assessor and add the following transition conditions:
  5. Add a link between Invoke Loan Approver and the Reply.
  6. Add a link from each Assign to the Reply.
  7. Do not add any link transitions to these links.

Your process should look similar to the following illustration. See the visual tips below the illustration.

Completed BPEL diagram for tutorial

Visual Tips:

Step 7: View the Create Instance property for the Receive activity

The Receive is the activity that kicks off the process, so you ensure that the Create Instance property is enabled. Designer automatically adds the Create Instance property to the first Receive (or other start) activity that you add to the process.

  1. In the Process Editor, select the Receive activity.
  2. In the Properties view, notice that a checkmark has been added to the Create Instance box.

Step 8: Save your file and validate your process

  1. Save your file.
  2. View Problems view, stacked next to Properties view. There should be no errors listed.
  3. If any errors are listed, double-click the error to go to the source of the error. You can also compare your file to loanprocesscompleted.bpel to discover any differences.

You have completed the main process definition.

Continue to Tutorial Part 6: Adding Fault Handling.