Skip Headers
Oracle® Fusion Middleware Developer's Guide for Oracle SOA Suite
11g Release 1 (11.1.1.6.2)

Part Number E10224-14
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

51 Using Two-Layer Business Process Management (BPM)

This chapter describes how to use two-layer Business Process Management (BPM). Two-layer BPM enables you to create dynamic business processes whose execution, rather than being predetermined at design time, depends on elements of the context in which the process executes. Such elements can include, for example, the type of customer, the geographical location, or the channel.

To illustrate further, assume you have an application that performs multichannel banking using various processes. In this scenario, the execution of each process depends on the channel for each particular process instance.

This chapter includes the following sections:

51.1 Introduction to Two-Layer Business Process Management

Two-layer BPM enables you to model business processes using a layered approach. In that model, a first level is a very abstract specification of the business process. Activities of a first-level process delegate the work to processes or services in a second level. Figure 51-1 illustrates this behavior.

Figure 51-1 Two-Layer BPM

Architecture of Two-Layer BPM
Description of "Figure 51-1 Two-Layer BPM"

In Figure 51-1, the phase I activity of the business process can delegate its work to one of the corresponding layer II processes: Task 1.1, Task 1.2, or Task 1.3.

The two-layer BPM functionality enables you to create the key element (namely, the phase activity) declaratively.

By using the design time and runtime functionality of Oracle Business Rules, you can add more channels dynamically without having to redeploy the business process. Design time at runtime enables you to add rules (columns) to the dynamic routing decision table at runtime. Then, during runtime, business process instances consider those new rules and eventually route the requests to a different channel.

The design time at runtime functionality of Oracle Business Rules also enables you to modify the endpoint reference of a service that is invoked from a phase activity, pointing that reference to a different service.

Note:

You can use the design time at runtime functionality of Oracle Business Rules through Oracle SOA Composer and the Oracle Business Rules SDK.

For information about using Oracle SOA Composer and the Oracle Business Rules SDK, see:

To enable two-layer BPM, follow the steps shown in Table 51-1.

Table 51-1 Steps for Enabling Two-Layer BPM

Step Information

Install Oracle WebLogic Server.

Oracle WebLogic Server Installation Guide

Design the SOA composite application.

Section 51.4.1, "Designing the SOA Composite"

Create element-type variables named InputPhaseVariable and OutputPhaseVar.

Section 51.4.1, "Designing the SOA Composite"

Create a phase activity.

Section 51.2, "Creating a Phase Activity"

Create and edit the dynamic routing decision table.

Section 51.3, "Creating the Dynamic Routing Decision Table"

Add assign activities to the BPEL process model.

Section A.2.3, "Assign Activity"

Create the application deployment profile.

Chapter 43, "Deploying SOA Composite Applications"

Create an application server connection.

Section 43.7.1.1.1, "Creating an Application Server Connection"

Deploy the application.

Chapter 43, "Deploying SOA Composite Applications"


51.2 Creating a Phase Activity

In two-layer BPM, a phase is a level-1 activity in the BPEL process. It complements the existing higher-level Oracle Business Rules and human task BPEL activities.

You add a phase to a process declaratively in Oracle BPEL Designer by dragging and dropping it from the Oracle Extensions section of the Component Palette to the process model. Figure 51-2 provides details.

Figure 51-2 Phase Activity in BPEL Designer

Description of Figure 51-2 follows
Description of "Figure 51-2 Phase Activity in BPEL Designer"

Note:

The reference WSDL (layer 2 or called references) must have the same abstract WSDL as that for the phase reference that gets automatically created.

51.2.1 How to Create a Phase Activity

You create the phase activity for your composite application after you have created the necessary variables, as described in Section 51.4.1, "Designing the SOA Composite."

To create a phase activity:

  1. Double-click the Phase activity.

  2. In the Name field, enter a value.

  3. In the Input and Output Variables section, select the Add icon to add input and output variables.

  4. Select Add Input Variable. The dialog for selecting a variable appears.

  5. Select Process > Variables > phaseIn.

  6. Click OK. The Phase dialog is displayed with the phaseIn variable populated.

  7. From the Input and Output Variables icon, select Add Output Variable. The dialog for selecting a variable appears.Select Process > Variables > phaseOut.

  8. Click OK. The Phase dialog is displayed with the input and output variable names populated.Click OK. The Oracle BPEL Designer displays the BPEL process.

  9. From the File menu, select Save All.

  10. Close the BPEL process.

  11. Click the composite.xml link about the Oracle BPEL Designer. The SOA Composite Editor appears.

51.2.2 What Happens When You Create a Phase Activity

When you create a phase activity, the artifacts described in Table 51-2 are created.

Table 51-2 Artifacts Created with a Phase Activity

Artifact Description

BPEL scope

At the location where the user dropped the phase activity in the BPEL process, a new BPEL scope is created and inserted into the BPEL process. The scope has the name of the phase activity. Within the scope, several standard BPEL activities are created. The most important ones are one invoke activity to an Oracle Mediator and one receive activity from the Oracle Mediator.

Oracle Mediator component

With the SOA composite application of the BPEL process service component, a new Oracle Mediator service component is created. The Oracle Mediator service component is wired to the phase activity of the BPEL component that comprises the level-1 BPEL process where the phase activity has been dropped into the process model. The input and output of the Oracle Mediator service component is defined by the input and output of the phase activity.

The Oracle Mediator plan (the processing instructions of the Oracle Mediator service component) is very simple; it delegates creation of the processing instructions to the Oracle Business Rules service component.

Oracle Business Rules component

Within the SOA composite application of the BPEL process service component, a new Oracle Business Rules service component is created and wired to the Oracle Mediator component associated with the phase activity of the BPEL process service component. The Oracle Business Rules service component includes a rule dictionary. The rule dictionary contains metadata for such Oracle Business Rules engine artifacts as fact types, rulesets, rules, decision tables, and similar artifacts. As part of creating the Oracle Business Rules service component, the rule dictionary is preinitialized with the following data:

  • Fact Type Model: The data model used for modeling rules. The rule dictionary is populated with a fact type model that corresponds to the input of the phase activity with some fixed data model that is required as part of the contract between the Oracle Mediator and Oracle Business Rules service components.

  • Ruleset: A container of rules used as a grouping mechanism for rules. A ruleset can be exposed as a service. One ruleset is created within the rule dictionary.

  • Decision Table: From an Oracle Business Rules engine perspective, a decision table is a collection of rules with the same fact type model elements in the condition and action part of the rules so that the rules can be visualized in a tabular format. The new decision table is created within the ruleset.

  • Decision Service: A decision service is created that exposes the ruleset as a service of the Oracle Business Rules service component. The service interface is used by the Oracle Mediator to evaluate the decision table.


51.2.3 What Happens at Runtime When You Create a Phase Activity

At runtime, the input of the phase activity is used to evaluate the dynamic routing decision table. This is performed by a specific decision component of the phase activity. The result of this evaluation is an instruction for the Oracle Mediator. The Oracle Mediator routes the request to a service based on instructions from the decision component.

Note:

In the current release, an asynchronous phase activity is supported. A synchronous or one-way phase activity is not supported.

51.2.4 What You May Need to Know About Creating a Phase Activity

When creating a phase activity, you must know the following:

  • Rules that you must either configure or create in the decision service. This is based on data from the payload that you use to evaluate a rule.

  • For each rule created in the decision service, you must know the corresponding endpoint URL that must be invoked when a rule evaluates to true. This endpoint URL is used by the Oracle Mediator to invoke the service in layer 2.

    For information on specifying endpoints, see Section 51.4.3, "Creating and Editing the Dynamic Routing Decision Table."

    Note:

    No transformation, assignment, or validation can be performed on a payload.

51.3 Creating the Dynamic Routing Decision Table

A Dynamic Routing Decision Table is a decision table evaluated by Oracle Business Rules. Conditions are evaluated on the input data of a phase activity. The result of the evaluation is a routing instruction for the Oracle Mediator.

51.3.1 How to Create the Dynamic Routing Decision Table

After you have created the phase activity, the wizard launches the Oracle Business Rules Designer in Oracle JDeveloper for you to edit the Dynamic Routing Decision Table. Figure 51-3 shows a sample decision table within the Oracle Business Rules Designer.

Figure 51-3 Sample Decision Table

Description of Figure 51-3 follows
Description of "Figure 51-3 Sample Decision Table"

You can leave the information for the action attribute serviceBindingInfo empty while modeling the level-2 process phases and complete it after the level-1 process is being deployed using Oracle SOA Composer.

Once you have created and edited the Dynamic Routing Decision Table, the new level-1 phase activity appears in the BPEL process in Oracle JDeveloper, as illustrated in Figure 51-4.

Figure 51-4 Completed Level-1 Phase in Oracle JDeveloper

Description of Figure 51-4 follows
Description of "Figure 51-4 Completed Level-1 Phase in Oracle JDeveloper"

51.3.2 What Happens When You Create the Dynamic Routing Decision Table

By creating the Dynamic Routing Decision Table, you are configuring the decision service to dynamically evaluate the conditions applied to the incoming payload and give the corresponding routing rules to the Oracle Mediator. The Oracle Mediator then executes these rules when invoking the service in layer 2.

More specifically, here is what happens at design time when you create the Dynamic Routing Decision Table:

  • A new decision component is created in the composite of the project.

  • A new rule dictionary is created in the composite project directory.

  • The rule dictionary is populated with a data model that reflects the data model of the phase input; that is, the XML schema of the phase input is imported into the rule dictionary.

51.4 Use Case: Two-Layer BPM

This section describes how to build a sample SOA composite application for routing a customer order.

To build and run the sample:

  1. Model the sample by performing these tasks:

    1. Design the SOA composite as described in Section 51.4.1, "Designing the SOA Composite."

    2. Create the phase activity as described in Section 51.4.2, "Creating a Phase Activity."

    3. Create and edit the Dynamic Routing Decision Table as described in Section 51.4.3, "Creating and Editing the Dynamic Routing Decision Table."

    4. Add assign activities to the BPEL process model as described in Section 51.4.4, "Adding Assign Activities to the BPEL Process Model."

  2. Deploy the sample with Oracle JDeveloper as described in Section 51.4.5, "Deploying and Testing the Sample."

51.4.1 Designing the SOA Composite

You design the SOA composite application in Oracle JDeveloper.

To design the SOA composite application:

  1. In Oracle JDeveloper, from the File menu, select New. The New Gallery dialog appears. By default, Generic Application is selected.

  2. Click OK. The Create Generic Application wizard displays the first screen.

  3. In the Application Name field, enter BPELPhaseActivity and then click Next. The second page of the Create Generic Application wizard appears.

  4. In the Project Name field, enter BPELPhaseCustomerRouter.

  5. In the Project Technologies tab, from the Available section, select SOA and move it to the Selected section.

  6. Click Next. The third page of the Create Generic Application wizard appears.

  7. From the Composite Template list, select Composite With BPEL Process, and click Finish.

    The Create BPEL Process dialog appears.

  8. In the Name field of the Create BPEL Process dialog, enter CustomerRouterBPELProcess.

  9. From the Template list, select Asynchronous BPEL Process.

  10. Import the schema file (for this example, named CustomerData.xsd) into the project xsd folder. An XML schema definition (XSD) specifies the types of elements and attributes that may appear in an XML document, their relationship to each other, the types of data they may contain, and other things.

    1. In the Input field, click the Browse Input Elements icon.

      The Type Chooser dialog displays.

    2. Click the Import Schema File icon, as shown in Figure 51-5.

      Figure 51-5 Import Schema File Icon

      Description of Figure 51-5 follows
      Description of "Figure 51-5 Import Schema File Icon"

      The Import Schema File dialog displays.

    3. To the right of the URL field, click the Browse Resources icon.

      The SOA Resource Browser appears.

    4. Select File System and, in the Location section, search for the schema file (for this example, named CustomerData.xsd) in the artifacts/schema folder, then click OK.

    5. In the Import Schema dialog, ensure the schema file (for this example, named CustomerData.xsd) now appears in the URL field and the Copy to Project option is selected, and then click OK.

      The Localize Files dialog prompts you to import the schema file and any dependent files.

    6. Deselect the option Maintain original directory structure for imported files and click OK to import the files.

      The Type Chooser dialog appears.

    7. Expand Project Schema Files > schema_file (for this example, named CustomerData.xsd) > Customer and then click OK, as shown in Figure 51-6.

      Figure 51-6 Type Chooser Dialog

      Description of Figure 51-6 follows
      Description of "Figure 51-6 Type Chooser Dialog"

  11. After importing the schema file, open the CustomerRouterBPELProcess BPEL process.

To create variables:

Note:

Phase variables can be of the element type only.

  1. Click the Variables icon. The Variables dialog appears.

  2. Click the Create icon. The Create Variable dialog appears.

  3. In the Name field, enter InputPhaseVariable.

  4. Click the Element option.

  5. Click the Browse Elements icon. The Type Chooser dialog appears.

  6. Select Project Schema Files > schema_file (for this example, named CustomerData.xsd) > Customer, and then click OK. The Create Variable dialog appears with the element name populated.

  7. Click OK. The Variables dialog is displayed with the variable name populated.

  8. Click the Create icon in the Variables dialog. The Create Variable dialog appears.

  9. In the Name field, enter OutputPhaseVariable.

  10. In the Type section, select the Element option.

  11. Click the Browse Elements icon. The Type Chooser dialog appears.

  12. Select Project Schema Files > schema_file (for this example, named CustomerData.xsd) > Customer, and then click OK. The Create Variable dialog appears with the element name populated.

  13. Click OK. The Variables dialog appears with the input and output variable names populated.

  14. Click OK. The variables have been created and the CustomerRouterBPELProcess BPEL process appears.

51.4.2 Creating a Phase Activity

To create a phase activity:

  1. In the CustomerRouterBPELProcess BPEL process, drag and drop a phase activity from the Component Palette into the process model, between receiveInput and replyOutput. The Phase dialog appears.

  2. In the Name field, enter CustomerRoutingPhase_1.

  3. From the Inputs and Outputs Variables icon, select Add Input Variable. The Add Input Variable dialog appears.

  4. Select Process > Variables > variable_name (for this example, named phaseIn), and then click OK. The Phase dialog is displayed with the variable populated.

  5. From the Inputs and Outputs Variables icon, select Add Output Variable. The Add Output Variable dialog appears.

  6. Select Process > Variables > variable_name (for this example, named OutputPhaseVar).

  7. Click OK. The Phase dialog displays the input and output variable names.

  8. Click OK. The CustomerRouterBPELProcess BPEL process appears.

  9. From the File menu, select Save All.

  10. Close the CustomerRouterBPELProcess BPEL process.

  11. Click composite.xml. The SOA Composite Editor is displayed.

Note:

  • As part of the phase activity wizard, three components are created: Oracle Business Rules, Oracle Mediator, and Dynamic Reference.

  • The Oracle Business Rules service component returns an executable case for the Oracle Mediator service component, because of the rules defined.

  • The Oracle Mediator service component performs routing based on the routing rules received from the Oracle Business Rules service component.

  • The Dynamic Reference component is the dummy reference for the second-level processes.

  • The rule dictionary is populated with the fact type model of the Oracle Mediator and the fact type corresponding to the input of the phase activity, which in this case is CustomerData.

  • An empty decision table called the Routing Table is created that must be edited to provide dynamic routing rules.

51.4.3 Creating and Editing the Dynamic Routing Decision Table

To create and edit the Dynamic Routing Decision Table:

  1. Open the CustomerRouterBPELProcess BPEL process, and double-click the Phase activity in the process diagram. The Phase dialog appears.

  2. Click the Edit Dynamic Rules button. The Oracle Business Rules Designer page appears.

  3. Under Rulesets, click Ruleset_1. The Ruleset_1 page with an empty Routing Table appears, as shown in Figure 51-7.

  4. In DecisionTable_1, click the Add icon, then Action > Assert New. The Actions section of the table appears.

  5. In the serviceBindingInfo, specify the SOAP endpoints, replacing the hostname and host port with SOA server details. In this example, localhost is the host server and 8001 is the host port. The composite in this example is named CustomerRouter and it must already be deployed.

    • In the otherwise column, enter the following:

      http://hostname:host_port/soa-infra/services/default/CustomerRouter!1.0/
      DefaultCustomerRouterService
      
    • In the Intel column, enter the following:

      http://hostname:host_port/soa-infra/services/default/CustomerRouter!1.0/
      SilverCustomerRouterService
      
    • In the Cisco column, enter the following:

      http://hostname:host_port/soa-infra/services/default/CustomerRouter!1.0/
      GoldCustomerRouterService
      
    • In the HP column, enter the following:

      http://hostname:host_port/soa-infra/services/default/CustomerRouter!1.0/
      PlatinumCustomerRouterService
      

51.4.4 Adding Assign Activities to the BPEL Process Model

Before deploying the phase activity, you must initialize the phase variables. You do this by adding assign activities in the phase in the BPEL process.

To add assign activities to the BPEL process model:

  1. Click the CustomerRouterBPELProcess BPEL process.

  2. Drag and drop an Assign activity from the Component Palette into the process model between the receiveInput activity and the Phase activity. The Assign activity is added to the process model.

  3. Double-click the Assign activity. The Assign dialog is displayed.

  4. Select the General tab.

  5. In the Name field, enter AssignInput.

  6. Select the Copy Rules tab.

  7. Select the source section. For this example, Variables > Process > Variables > inputVariable > payload > ns1:Customer is selected.

  8. Select the target section. For this example, Variables > Process > Variables > inputVariable > payload > ns1:Customer is selected.

  9. Drag the source node to the target node (for example, drag the source ns1:Customer node to the target ns1:Customer node).

    The input copy rule is recorded at the bottom of the Edit Assign dialog, as shown in Table 51-3.

    Table 51-3 Input Copy Rule for Adding Assign Activities

    From To

    inputVariable/payload//ns1:Customer

    InputPhaseVar///payload/ns1:Customer


  10. Click OK. The CustomerRouterBPELProcess process is displayed again.

  11. Drag and drop another Assign activity from the Component Palette into the process model between the Phase activity and the replyOutput activity. The new Assign activity is added to the process model.

  12. Double-click the Assign activity. The Assign dialog appears.

  13. In the Name field in the General tab, enter AssignOutput.

  14. Select the Copy Rules tab.

  15. Select the source section. For this example, Variables > Process > Variables > OutputPhaseVar > payload > ns1:Customer/ns1:status is selected.

  16. Select the target section. For this example, Process > Variables > outputVariable > payload > client:processResponse > client:result is selected.

  17. Drag the source ns1:status node to the target client:result node.

    The output copy rule is recorded, as shown in Table 51-4.

    Table 51-4 Output Copy Rule for Adding Assign Activities

    From To

    OutputPhaseVar///ns1:Customer/ns1:status

    outputVariable/payload//client:processResponse/client:result


  18. Click OK. The CustomerRouterBPELProcess BPEL process appears after the input and output assign activities are created.

  19. From the File menu, select Save All.

51.4.5 Deploying and Testing the Sample

For instructions on deploying the sample, see Section 43.7, "Deploying SOA Composite Applications."

For instructions on testing a composite instance in Oracle Enterprise Manager Fusion Middleware Control, see Oracle Fusion Middleware Administrator's Guide for Oracle SOA Suite and Oracle Business Process Management Suite.