ActiveVOS 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, shown displays all major components of a BPEL process. The Outline view shown on the left, in the following illustration, 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 participants, you have automatically added the appropriate namespace, participants, 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, ActiveVOS identifies the correct WSDL file by using the Imports function. The import is automatically added when you create a participant, and a default namespace prefix is also added, 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 loanMessages prefix are two of the namespaces added.
  4. ActiveVOS creates namespace prefixes based on WSDL filenames and adds them to the process. The loanProcess.wsdl generates the loan prefix the loanRequest.xsd file and loanMessages for loanMessages.wsdl file.

  5. Notice the prefixes for all imported WSDLs, which will appear in variable expression that you will create in the process:
  6. WSDL/XSD file from the Namespace URI

    Prefix

    loanRequest.xsd

    loan

    loanMessages.wsdl

    loanMessages

    loanProcess.wsdl

    loanProcess

    riskAssessment.wsdl

    riskAssessment

    loanApproval.wsdl

    loanApproval

Tip: All new processes contain common namespaces. The xsd namespace defines the location of the XML schema. The bpel namespace defines the location of the BPEL schema. ActiveVOS adds other namespaces used internally by the process.

Step 3: Adding Programming Logic with an If Activity

The risk assessment determines who is a high risk or low risk, or who needs more review. These conditions will be represented with a control flow activity, the If activity.

  1. From the Control Flow drawer of the palette, select a Conditional Pattern activity and drop it just below the invoke activity as shown.
  2. if activity

    Note that the activity is already structured with If and Else conditional paths. The else condition is indicated with a slash at the beginning of its path.

  3. We need to add an Else If condition. Select the starting diamond of the If, and right mouse-click to select Add>Other>If Condition, as shown.
  4. add other if condition

  5. Select the first If Condition label and rename it large loan or review risk.
  6. Tip: Click once to select the label and then click the text to edit it.

  7. Select the next If Condition label and rename it low risk.
  8. Be sure to label the two if conditions in order, left to right. The left-most condition is evaluated first at runtime, as we will see later.

  9. Select the Else label and rename it high risk.
  10. Select the Conditional Pattern label and change it to what is risk level.
  11. Your process should now look like the following:

    If Expression Builder dialog

  12. Save your file. More errors are reported, which we will address next.

Step 4: Create Conditional Expressions

We will add conditional processing for each If Condition path.

  1. Double-click low risk to open the If Expression Builder, as shown.
  2. In the Builder dialog, expand the riskAssessment variable and double-click the riskAssessment part to add the appropriate expression to the If Expression box.
  3. Complete the expression as follows: $riskAssessment/loan:riskAssessment = 'low' This is shown in the following example.
  4. If Expression Builder dialog

  5. For the large loan or review risk condition, create an expression for two conditions:
    1. Expand the creditInformation message, and double-click the amountRequested part.
    2. Complete the expression by adding the large loan amount and the risk assessment review condition, as shown.

    $creditInformation/loan:amountRequested >= 10000 or $riskAssessment/loan:riskAssessment = 'review'

If Expression Builder dialog

Step 5: Create the reply for the low risk condition

If the customer requests less than $10,000 and is a low risk, the customer will be approved for a loan. We will create a reply with this message.

  1. From the Throw Event drawer of the palette, drag a Message to the blue bounding box of the low risk condition as shown.
  2. add reply to if condition

  3. Fill in the reply properties in the Properties view as follows:
    1. Activity Name: Approve
    2. Participant: loanProcessor
    3. Operation: request
  4. Select the Data tab of the Properties view.
  5. Note that the Assignment Type is XPaths. XPath expressions allow you to select nodes from a variable for assignment. We will map a literal expression to the reply variable, as follows.
    1. The table structure on this data tab allows for several XPath expressions. We need only one expression. Select Add. The Add button is to the right of the table.
    2. In the E/L column, select the f(x) (Expression) entry and change it to (k) Literal expression.
    3. Click in the From column and select the Dialog (...) button to open the Literal Contents dialog.
    4. Select Generate, and in the XML Data Wizard, notice that the matching data type, loanApprovalResponse, is selected as the Root Element. The element-based approval message is a single part element.
    5. Select Finish. The Literal Contents looks like the following:
    6. literal contents

    7. Replace the loan:responseDescription string with the following: Your excellent credit has earned you automatic approval for your loan.
    8. Delete the entire <loan:rejectionReason></loan:rejectionReason> element. The resulting literal expression is as follows:
    9. <loan:loanApprovalResponse xmlns:loan="http://schemas.active-endpoints.com/sample/LoanRequest/2008/02/loanRequest.xsd">
      <loan:responseToLoanRequest>approved
      </loan:responseToLoanRequest>
      <loan:responseDescription>Your excellent credit
      has earned you automatic approval for your loan.
      </loan:responseDescription>
      </loan:loanApprovalResponse>
  6. The Data tab should look like the following.
  7. data tab of reply

Step 5: Create the reply for the high risk condition

The reply for the high risk customer is created with almost identical steps used for the low risk customer. So we’ll take a shortcut and make a copy of the approve reply to create the deny reply.

  1. Copy the Approve reply and paste it into a blank area of the canvas. The reply is pasted into the top-left corner.
  2. In the Properties view, rename the Activity Name to Deny. The Participant and Operation are already filled in.
  3. On the Data tab, select in the From cell to display a Dialog (...) button, and select the Dialog (...) button.
  4. Select Generate, then Finish.
  5. Edit the literal contents for the denied loan. The message should read as follows:
  6. <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>
  7. Drag the Deny reply to the bounding box in the high risk condition. Your process should now look like the following.
  8. Approve and Deny replies

Step 6: Create the invoke loan approver activity

We have one more path to complete for the If activity: the case where the loan request is large or the customer’s risk level could not be determined by the risk assessment service.

Recall that earlier we created two partner services for the process. We are already using the risk assessment service via the risk assessment invoke activity. Now we will use the loan approval service.

  1. In the Participants view expand Partner Service Providers to view the LoanApproval partner.
  2. Expand LoanApproval to view the approve operation.
  3. Drag the approve operation to the bounding box of the large loan or review risk condition. A new invoke activity is created, as shown.
  4. Approve and Deny replies

  5. In the Properties view, name the activity Invoke Loan Approval.
  6. Select Green for the activity color.
  7. On the Input tab, in Assignment Type, select Single Variable.
  8. For the Variable, select creditInformation.
  9. On the Output tab, in Assignment Type, select Single Variable.
  10. For the Variable, select approval.

Step 8: Add the Loan Approval reply

Select the Return Approval Response reply and drag it into the bounding box containing the new invoke activity. Be sure to move the activity very close to the bottom of the invoke activity to place it in sequence inside the bounding box.

Notice that the process now has three discrete end activities, clarifying the process flow.

Your completed process definition should look like the following.

complete process

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

The Receive is the activity that kicks off the process, so you want to ensure that the Create Instance property is enabled. Designer automatically adds the Create Instance property to the 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 10: Save your file and validate your process

  1. Save your file. When you save it, it is automatically validated for BPEL.
  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.

Tip: You can compare your file to tutorialCompleted.bpel to discover any differences. To open a completed version of the tutorial, select File>New>Orchestration Project, name the project, click Next, and then select the Template Tutorial Completed.

Note that the tutorialCompleted.bpel file has one difference: The sequence surrounding the process has been removed by using the Ungroup right-mouse menu option.

You have completed the main process definition.

Continue to Tutorial Part 6: Adding Fault Handling.