Legal | Privacy
Using Oracle JDeveloper 10g BPEL Designer to Model and Deploy the Loan Flow Process

Using Oracle JDeveloper 10g BPEL Designer to Model and Deploy the Loan Flow Process

This tutorial covers the use of Oracle JDeveloper 10g BPEL Designer to invoke the United Loan, Star Loan, and Credit Rating Web services. This tutorial uses JDeveloper to create a BPEL process called MyLoanProcess.

Approximately 1 hour

Topics

This tutorial covers the following topics:

Creating a New BPEL Project and a BPEL Process Manager Connection

Creating the Partner Links

Adding New Process Variables
Designing the Loan Flow Process
Deploying and Testing the Loan Flow Process

Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: Because this action loads all screenshots simultaneously, response time may be slow depending on your Internet connection.)

Note: Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step.

Overview

This tutorial demonstrates how to design the Loan Flow BPEL process by using Oracle JDeveloper 10g BPEL Designer. MyLoanProcess performs a credit check, by invoking the CreditRatingService synchronously with a loan application from the client. The loan application returned with a credit rating (from the CreditRatingService) is then processed asynchronously by the following two Web services:

UnitedLoan Web service
StarLoan Web service

Back to Topic List

The loan application document, supplied by a client, is first modified with a credit rating value after synchronously invoking a CreditRatingService process. The modified loan document is processed in parallel by the UnitedLoan and StarLoan Web services. Each loan-provider Web service returns a loan offer that is document for acceptance or processing by the client.

Back to Topic List

Prerequisites

Before starting this tutorial, you should:

1.

Install Oracle JDeveloper BPEL Designer and the Oracle BPEL PM Server into a directory called D:\JDeveloper\JDevBPEL.


2.

Start the Oracle BPEL PM Server as follows:
Start > Programs > Oracle - OracleBPM > Oracle BPEL Process Manager 10.1.2 > Start BPEL PM Server


3.

Start the Oracle JDeveloper 10g BPEL Designer by double-clicking the desktop icon labeled BPEL Designer:

Note: You can select Start > Programs > Oracle - OracleBPM > Oracle BPEL Process Manager 10.1.2 > BPEL Designer to start Oracle JDeveloper 10g BPEL Designer.

 

4.

Deploy the CreditRatingService, StarLoan, and UnitedLoan Web services to the Oracle BPEL PM Server by entering the following commands in a command window:

D:
cd \JDeveloper\JDevBPEL\integration\bpm\orabpel\samples\demos\LoanDemo
obant

Note: A BPEL process called LoanFlow is deployed by executing the obant script in the LoanDemo directory. However, the LoanFlow BPEL process was removed from the BPEL Server to avoid confusion with the MyLoanProcess BPEL process that is created in this tutorial.

 

5.

Verify that the CreditRatingService, StarLoan, and UnitedLoan Web services have been deployed, select Start > Programs > Oracle - OracleBPM > Oracle BPEL Process Manager 10.1.2 > BPEL Console. The BPEL Console shows the Web service names in the Deployed BPEL Process column on the Dashboard page:

 

6.

Right-click this LoanFlow.xsd link to download and save the link or target to a file in a directory called C:\Hands_on_Labs\bpel_jdev\support_files, or a temporary directory of your choice.

 

Back to Topic List

Creating a New BPEL Project and a BPEL Process Manager Connection

To create a new BPEL project, perform the following steps:

1.

In the Oracle JDeveloper 10g BPEL Designer menu, select File > New:

Place the cursor over this icon to see the image

 

2.

In the New Gallery window, click the General category and select the Workspace item:

Place the cursor over this icon to see the image

Click OK.

 

3.

In the Create Workspace dialog box, apply the following field values:

Workspace Name: MyLoanProcessWS

Directory Name: Accept the value automatically resembling the workspace name entered.
Select Add a New Empty Project to clear the check box.

Leave the Open in New Navigator check box clear.

Place the cursor over this icon to see the image

Click OK.

 

4.

The new workspace, MyLoanProcessWS, appears in the JDeveloper Applications - Navigator pane under the Applications folder. Press [Ctrl]+[S] to save the new workspace:

Note: You can select File > Save to save the selected file, or you can select File > Save All to save changes to all files in the project.

 

5.

To create a new BPEL Project, right-click MyLoanProcessWS in the Applications - Navigator and select New Project:

Place the cursor over this icon to see the image

 

6.

In the New Gallery window, click Projects under General and select the BPEL Process Project item:

Place the cursor over this icon to see the image

Click OK.

 

7.

In the BPEL Process Project dialog box, enter the following values:

BPEL Process Name: MyLoanProcess

Namespace: http://xmlns.oracle.com/MyLoanProcess, which automatically mirrors the BPEL process name. Do not change this value.
Template: Asynchronous BPEL Process is selected by default. Accept this value.

In the Project Content area, the Use Default check box should be selected.

Click OK.

 

8.

In the Navigator, the following three files are created:

bpel.xml contains partner link bindings for the BPEL project.

MyLoanProcess.bpel contains the BPEL elements describing the BPEL process.
MyLoanProcess.wsdl describes the interfaces for the BPEL process as a Web service.

JDeveloper automatically opens MyLoanProcess.bpel on the Diagram View page.

Select File > Save All to save the new project files.

 

9.

The initial BPEL process activities for MyLoanProcess.bpel are shown on the Diagram View page:

Note: The Diagram View page is used to graphically create and edit the BPEL process.

 

10.

To view the BPEL structure for MyLoanProcess.bpel in the Structure pane, click the Diagram View tab.

To import an XML Schema document into the BPEL project directory, select Project Schemas in the Structure pane:

Click Import.

 

11.

In the Open window, use the Location field to navigate to the C:\Hands_on_Labs\bpel_jdev\support_files directory (or the temporary directory into which you downloaded the file). Select LoanFlow.xsd:

Select Open.

 

12.

In the Copy Schema message window, click Yes to copy the schema file into the project directory:

 

13.

In in the Applications - Navigator pane, expand the Miscellaneous Files node to see the LoanFlow.xsd file as a file in the project:

Click in the BPEL process Diagram View window to see the LoanFlow.xsd entry under the Project Schemas node in the Structure Pane.

The XML schema file provides definitions for the loanApplication and loanOffer types that are used to define the structure of the input and response documents of the BPEL process, respectively.

Select File > Save All to save the changes to the project and workspace.

 

14.

Double-click MyLoanProcess.bpel in the Applications - Navigator:

Click the Message Types icon in the toolbar.

 

15.

To set the message type for the loan request, select MyLoanProcessRequestMessage in the Message Types window.

click Edit.

16.

In the Edit Message Type window, select payload:

Click Edit.

 

17.

In the Edit Message Part - payload window, select Element:

Click the Browse Elements icon.

 

18.

In the Type Chooser window, expand Project Schema Files, expand LoanFlow.xsd, and select loanApplication:

Click OK.

 

19.

In the Edit Message Part - payload window, click OK:

 

20.

In the Edit Message Type window, click OK:

 

21.

To set the response message type for the BPEL process, select MyLoanProcessResponseMessage in the Message Types window:

Click Edit.

 

22.

In the Edit Message Type window for the response message, select payload:

Click Edit.

 

23.

In the Edit Message Part - payload window, select Element:

Click the Browse Elements icon.

 

24.

In the Type Chooser window, expand Project Schema Files, expand LoanFlow.xsd, and select loanOffer:

Click OK.

 

25.

To close the Edit Message Part - payload window, click OK. In the Edit Message Type window, click OK. In the Message Types window, click Close:

 

26.

To create a connection with the BPEL Process Manager, choose View > Connection Navigator:

Note: The Applications - Navigator tab is replaced with the Connections - Navigator tab.

 

27.

Right-click the BPEL Process Manager Server node and choose New BPEL Process Manager Server Connection from the context menu:

 

28.

On the Create BPEL Process Manager Server Connection - Welcome page, review the information on the Welcome page:

Click Next.

 

29.

In the Create BPEL Process Manager Server Connection - Step 1 of 3: Name window, enter BPEL_conn in the BPEL Process Manager Connection Name field:

Click Next.

 

30.

In the Create BPEL Process Manager Server Connection - Step 2 of 3: Connection window, accept the default values for the User Name, Host Name, and Port Number fields.

Enter welcome in the Password field:

Note: Characters entered in the Password field appear as asterisks (*).

Click Next.

 

31.

In the Create BPEL Process Manager Server Connection - Step 3 of 3: Test Connection window, click Test Connection:

 

32.

Wait for the text Success to appear in the Status field:

Click Finish.

 

33.

The new BPEL_conn is added under the BPEL Process Manager Server node in the Connections - Navigator pane:

Click the Application tab to switch to the Applications - Navigator to view the MyLoanProcess BPEL project files.

 

Back to Topic List

Creating the Partner Links

To create a partner link for each Web service that is invoked by the BPEL process, perform the following steps:

1.

With MyLoanProcess.bpel displayed in the Diagram View, select Process Activities from the Component Palette list:

Place the cursor over this icon to see the image

 

2.

To create a partner link for the CreditRatingService Web service, drag a PartnerLink object from the Component Palette to the Partner Links region on the right of the BPEL process activities:

Place the cursor over this icon to see the image

 

3.

In the Create Partner Link window, click the WSIL Browser icon to open the WSDL Chooser:

Place the cursor over this icon to see the image

 

4.

In the WSDL Chooser window under the WSIL Explorer node, expand the BPEL_conn, process, and default nodes. Select CreditRatingService:

Place the cursor over this icon to see the image

Click OK.

 

5.

In the Create Partner Link window, the WSDL File and Partner Link Type fields are populated by your selection in the WSDL Chooser. Enter or select the following field values:

Name: creditRatingService

My Role: ----- Not Specified -----

Partner Role: CreditRatingServiceProvider

The creditRatingService partner link box appears in the Partner Links region on the right of the BPEL process in the Diagram View:

 

6.

To create a partner link for the UnitedLoan Web service, drag a new PartnerLink object from the Component Palette to the Partner Links region on the right of the BPEL process activities:

 

7.

In the Create Partner Link window, click the WSIL Browser icon . In the WSDL Chooser, expand the BPEL_conn, process, and default nodes. Select UnitedLoan:

Click OK.

 

8.

In the Create Partner Link window for the UnitedLoan Web service, enter or select the following field values:

Name: unitedLoanService

My Role: LoanServiceRequester

Partner Role: LoanServiceProvider

Click OK.

The unitedLoanService partner link box is added to the Partner Links region on the right of the BPEL process in the Diagram View.

 

9.

To create a partner link for the StarLoan Web service, drag a PartnerLink object from the Component Palette to the Partner Links region on the right:

 

10.

In the Create Partner Link window, click the WSIL Browser icon . In the WSDL Chooser, expand the BPEL_conn, process, and default nodes. Select StarLoan:

Click OK.

 

11.

In the Create Partner Link window for the StarLoan Web service, enter or select the following field values:

Name: starLoanService

My Role: LoanServiceRequester

Partner Role: LoanServiceProvider

Click OK.

The starLoanService partner link box is added to the Partner Links region on the right of the BPEL process in the Diagram View.

Select File > Save All to save the changes to the project files.

 

Back to Topic

Adding New Process Variables

To create variables for activities in the MyLoanProcess BPEL process, perform the following steps:

1.

In the MyLoanProcess.bpel - Structure pane, expand the Variables node, the Process subnode, and its Variables child node to view two variables defined as inputVariable and outputVariable:

Place the cursor over this icon to see the image

 

2.

To create an input variable for the CreditRatingService, in the Structure pane select Variables under the Process subnode. Then click Create:

Place the cursor over this icon to see the image

 

3.

In the Create Variable window, enter crInput in the Name field, select Message Type, and click the Browse Message Types icon :

 

4.

In the Type Chooser window, expand Message Types, Partner Links, creditRatingService, CreditRatingService, and Message Types. Select CreditRatingServiceRequestMessage:

Click Ok.

 

5.

In the Create Variable window, click OK:

The crInput variable appears in the list of BPEL process variables in the Structure pane.

 

6.

Create an output variable for the CreditRatingService, and then select Variables under the Process subnode in the Structure pane. Click Create.

In the Create Variable window, enter crOutput in the Name field. Select Message Type with the value CreditRatingServiceResponseMessage selected from the CreditRatingService, Message Types node:

Click OK.

 

7.

Create an error variable for the CreditRatingService, select Variables, and then click Create.

In the Create Variable window, enter crError in the Name field. Select Message Type with the value CreditRatingServiceFaultMessage selected from the CreditRatingService, Message Types tree:

Click OK.

Select File > Save All to save the changes to the project files.

 

8.

Create the loan application input variable for the UnitedLoan and StarLoan Web Services, select Variables, and then click Create.

In the Create Variable window, enter loanApplication in the Name field. Select Message Type with the value LoanServiceRequestMessage selected from the UnitedLoanService, Message Types tree:

Click OK.

 

9.

Create the loan offer output variable for the UnitedLoan Web Service, select Variables, and then click Create.

In the Create Variable window, enter unitedOffer in the Name field. Select Message Type with the value LoanServiceResultMessage selected from the UnitedLoanService, Message Types tree:

Click OK.

 

10.

Create the loan offer output variable for the StarLoan Web Service, select Variables, and then click Create.

In the Create Variable window, enter starOffer in the Name field. Select Message Type with the value LoanServiceResultMessage selected from the StarLoanService, Message Types tree:

Click OK.

Select File > Save All to save the changes to the project files.

 

11.

In the Structure pane for MyLoanProcess.bpel, verify that the eight process variables (displayed in the accompanying screenshot) are defined under the BPEL Structure > Variables > Process > Variables node:

 

Back to Topic List

Designing the Loan Flow Process

During the creation of the BPEL process, you should regularly save the changes made to your MyLoanProcess.bpel file and project. After completing the steps for each new BPEL activity, select File > Save All to save the changes that you make.

This section covers the following subtopics:

Invoking the Synchronous CreditRatingService Web Service
Adding a Fault Handler for the CreditRatingService
Invoking the Asynchronous UnitedLoan and StarLoan Web Services in Parallel

Adding a Conditional Branch to Select a Loan Offer

Back to Topic List

Invoking the Synchronous CreditRatingService Web Service

To design the loan flow process activities that synchronously invoke the CreditRatingService Web service, perform the following steps:

1.

In the JDeveloper Diagram View, drag a Scope from the Component Palette to the region between the receiveInput and callbackClient activities:

Place the cursor over this icon to see the image

 

2.

To name the new Scope, double-click Scope_1 in the Diagram View. On the General page of the Scope dialog box, enter the value GetCreditRating in the Name field :

Place the cursor over this icon to see the image

Click OK.

 

3.

To expand, click for the GetCreditRating scope:

 

4.

In the Diagram View, drag an Assign activity from the Component Palette to the region labeled Drop Activity Here in the GetCreditRating scope:

 

5.

 

Next, create a copy rule to get the SSN value from the inputVariable into the crInput variable for passing to the CreditRatingService. To do this, double-click the Assign_1 activity to display the Assign properties:

Click Create on the Copy page.

 

6.

In the Create Copy Rule window, click the Browser Variables icon on the right of the Variable field in the From section:

 

7.

In the Variable Chooser window, select inputVariable:

Click OK.

 

8.

In the Create Copy Rule window, choose payload in the Part field:

 

9.

Click the XPath Query field in From section of the Create Copy Rule window. Use the XPath Building Assistant to enter the XML path /ns1:loanApplication/ns1:SSN.

Then press [Ctrl]+[Space] to invoke the XPath Building Assistant and show the root element of the inputVariable XML schema type:

Double-click the /ns1:loanApplication element.

 

10.

The XPath Building Assistant automatically displays the child elements in /ns1:loanApplication:

Double-click ns1:SSN to complete the XPath Query field.

The fields in the From section should contain the following values:

Variable: inputVariable

Part: payload

XPath Query: /ns1:loanApplication/ns1:SSN

 

11.

Using the same techniques from the preceding five steps, complete the To section in the Create Copy Rule to contain the following field values:

Variable: crInput

Part: payload

XPath Query: /ns2:ssn

Click OK to save the copy rule settings.

 

12.

Check the new copy rule details in the Assign properties section:

Note: The Invalid Settings error message is not meaningful until you click Apply or OK. The error message is cleared if the details entered are valid.

Click OK.

 

13.

Drag an Invoke activity from the Component Palette to the GetCreditRating Scope after the Assign_1 activity:

 

14.

To enable the Invoke activity to initiate the CreditRatingService, double-click the Invoke_1 activity to set the following property values on the General page:

Name: invokeCR

Partner Link: creditRatingService

Input Variable: crInput.
Output Variable: crOutput

The input and output variable fields can be set by selecting a value from the Variable Chooser window, which is displayed if you click the Browse Variables icon. In addition, when you choose the Partner Link value, the following field values are automatically filled:

Partner Role: CreditRatingServiceProvider
Port Type: CreditRatingService
Operation: process

Click OK.

 

15.

Drag another Assign activity from the Component Palette to the GetCreditRating Scope after the invokeCR activity:

 

16.

Double-click the Assign_2 activity. To add a copy rule, click Create on the Copy page.

in the From section of the Create Copy Rule window, enter the following field values:

Variable: crOutput

Part: payload

XPath Query: /ns2:rating

Press[Ctrl]+[Space] in the XPath Query field to use the XPath Building Assistant.

In the To section, enter the following field values:

Variable: inputVariable

Part: payload

XPath Query: /ns1:loanApplication/ns1:creditRating

Click OK to close the Create Copy Rule window. Make sure that the copy rule is added to the Assign properties. Click OK to close the Assign properties.

Select File > Save All to save the changes to the BPEL project.

 

Back to Topic

Adding a Fault Handler for the CreditRatingService

To add the process activities for handling faults that are returned by the CreditRatingService Web service and terminate the BPEL process, perform the following steps:

1.

You want to add a fault handler for the NegativeCredit fault that is generated when the CreditRatingService is invoked with an SSN value that starts with a leading zero. To do so, first click the Add Catch Branch icon on the GetCreditRating scope:

 

2.

Double-click the icon in the Add Catch branch:

 

3.

On the General page, set the following field values in the Catch properties:

Fault Name: ns2:NegativeCredit

Fault Variable: crError

Note: The Fault Name must be called NegativeCredit, as defined in the WSDL for the CreditRatingService Web Service. The namespace prefix, ns2, must match the namespace prefix that is used to qualify the crError variable in this BPEL process. The Fault Variable value can be chosen from the Variable Chooser if you click the Browse Variables icon.

Click OK.

 

4.

To handle the fault, drag an Assign activity to the region labeled Drop Activity Here in the ns2:NegativeCredit Catch branch:

 

5.

To add the copy rules needed to indicate that the loan offer is not approved in the outputVariable, double-click Assign_3. In the Assign properties. Then click Create to add the first copy rule on the Copy page.

In the From section of the Create Copy Rule window, set the Expression field to the value
string('None - rejected because of bad credit') by using the following sequence of actions:

Choose the Expression option, and then click in the Expression field.

Press [Ctrl]+[Space] to invoke the XPath Building Assistant.

Enter st to limit the list of XPath functions displayed, and then double-click string(any param) as String.
Enter the text 'None - rejected because of bad credit' within the brackets of the string() function.

In the To section, set the following field values:

Variable: outputVariable

Part: payload

XPath Query: /ns1:loanOffer/ns1:providerName

Note: Press [Ctrl]+[Space] to use the XPath Building Assistant to set the XPath Query field.

Click OK.

 

6.

In the Assign properties, click Create to add a second copy rule.

In the From section of the Create Copy Rule window, set the Expression field value to the function false() by using the XPath Building Assistant:

In the To section, set the following field values:

Variable: outputVariable

Part: payload

Press [Ctrl]+[Space] in XPath Query to build the value /ns1:loanOffer/ns1:selected.

Click OK.

 

7.

In the Assign properties, click Create to add a third copy rule.

In the From section of the Create Copy Rule window, set the Expression field value to the function false() by using the XPath Building Assistant:

In the To section, set the following field values:

Variable: outputVariable

Part: payload

Press [Ctrl]+[Space] in XPath Query to build the value /ns1:loanOffer/ns1:approved.

Click OK.

 

8.

In the Assign properties, click Create to add the four and last copy rule.

In the From section of the Create Copy Rule window, set the Expression field value to number(100) by using the XPath Building Assistant:

In the To section, set the following field values:

Variable: outputVariable

Part: payload

Press [Ctrl]+[Space] in XPath Query to build the value /ns1:loanOffer/ns1:APR.

Click OK.

 

9.

Verify that there are four copy rules on the Copy page of the Assign properties. Then click Apply.

Click OK.

 

10.

To call back the client, drag an Invoke activity from the Component Palette to the region after Assign_3 in the ns2:NegativeCredit Catch branch:

 

11.

Double-click the Invoke_1 activity. In the Invoke properties, set the following field values:

Name: badCreditClientCallback

Partner Link: client

Input Variable: outputVariable
Output Variable is empty.

After you explicitly choose client as the Partner Link value, the following field values are automatically populated:

Partner Role: MyLoanProcessRequester

Port Type: MyLoanProcessCallback
Operation: onResult

Click Apply.

Click OK.

 

12.

To terminate the BPEL process due to the occurrence of a NegativeCredit fault, drag a Terminate activity from the Component Palette after the badCreditClientCallback invoke activity in the ns2:NegativeCredit Catch branch:

Note: Click the collapse icon in the upper-left corner of the GetCreditRating scope to minimize the area used.

Select File < Save All to save the changes to the BPEL project.

 

Back to Topic

Invoking the Asynchronous UnitedLoan and StarLoan Web Services in Parallel

To design the process activities that asynchronously invoke the UnitedLoan and StarLoan Web services in parallel, perform the following steps:

1.

To create a scope for the parallel flow, drag a Scope component from the Component Palette after the first GetCreditRating scope:

 

2.

To change the name of the new scope, double-click Scope_1. Enter GetLoanOffers in the Name field:

Click OK.

Expand the GetLoanOffers scope.

 

3.

To initialize the loanApplication variable, drag an Assign activity to the Drop Activity Here region of the GetLoanOffers scope:

 

4.

To set the assign activity properties, double-click the Assign_4 activity. Click the General tab. Change the Name field contents to InitializeInput:

Click the Copy tab.

On the Copy page, click Create to open the Create Copy Rule window. Populate fields in the From section with the following values:

Variable: inputVariable

Part: payload

Leave the XPath Query field empty.

In the To section, populate the following field values:

Variable: loanApplication

Part: payload

Leave the XPath Query field empty.

Click OK to close the Create Copy Rule window.

Click Apply, and then click OK to close the Assign property dialog box.

 

5.

To create the parallel flow, drag a Flow component to the region after the InitializeInput assign activity:

The flow is automatically expanded and contains parallel left and right regions for activities.

 

6.

On the left side of the flow, drag an Invoke component to the Drop Activity Here region:

 

7.

Double-click Invoke_1, and then set the following Invoke properties:

Name: invokeUnitedLoan

Partner Link: unitedLoanService

Input Variable: loanApplication

Note: The Output Variable property cannot be set when invoking an asynchronous Web service.

When you choose unitedLoanService as the Partner Link value, the following fields are automatically populated:

Partner Role: LoanServiceProvider

Port Type: LoanService
Operation: initiate

Click OK.

 

8.

On the left side of the flow, drag a Receive component after the invokeUnitedLoan activity:

 

9.

Double-click Receive_1, and then set the following Receive properties:

Name: receive_invokeUnitedLoan

Partner Link: unitedLoanService

Variable: unitedOffer

When you choose unitedLoanService as the Partner Link value, the following properties are automatically populated:

My Role: LoanServiceRequester
Port Type: LoanServiceCallback
Operation: onResult

Note: Do not select the Create Instance check box.

Click OK.

 

10.

On the right side of the flow, drag an Invoke component to the Drop Activity Here region:

 

11.

Double-click Invoke_1, and then set the following Invoke properties:

Name: invokeStarLoan

Partner Link: starLoanService

Input Variable: loanApplication

When you choose starLoanService as the Partner Link value, the following fields are automatically populated:

Partner Role: LoanServiceProvider

Port Type: LoanService
Operation: initiate

Click OK.

 

12.

On the right side of the flow, drag a Receive component after the invokeStarLoan activity:

 

13.

Double-click Receive_1, and then set the following Receive properties:

Name: receive_invokeStarLoan

Partner Link: starLoanService

Variable: starOffer

When you choose starLoanService as the Partner Link value, the following properties are automatically populated:

My Role: LoanServiceRequester
Port Type: LoanServiceCallback
Operation: onResult

Note: Do not select the Create Instance check box.

Click OK.

Collapse the GetLoanOffers scope.

Select File > Save All to save the changes to the BPEL project.

 

Back to Topic

Adding a Conditional Branch to Select a Loan Offer

To create a conditional branch of BPEL activities to select the best loan offer from either the UnitedLoan or the StarLoan Web services, perform the following steps:

1.

Drag a Scope component after the GetLoanOffers scope:

 

2.

To set the scope name, double-click Scope_1 and enter ChooseLoanOffer in the Name property:

Click OK.

3.

To create a conditional branch, expand the ChooseLoanOffer scope and drag a Switch activity to the Drop Activity Here region:

The switch activity implements a conditional branch that initially contains a <case> branch on the left and an <otherwise> branch on the right.

 

4.

To create the condition, double-click the <case> branch:

 

5.

In the Switch Case properties, use the XPath Building Assistant to construct the following condition in the Expression field:

bpws:getVariableData('unitedOffer', 'payload', '/ns1:loanOffer/ns1:APR') > 
bpws:getVariableData('starOffer', 'payload', '/ns1:loanOffer/ns1:APR')

Click in the Expression field. Press [Ctrl]+[Space] to invoke the XPath Building Assistant:

Double-click the bpws:getVariableData entry, with three String arguments, from the XPath Building Assistant list.

 

6.

After the bpws:getVariableData() function call is entered in the Expression field, the XPath Building Assistant provides a selection of values for the first String argument:

Double-click unitedOffer.

 

7.

After the unitedOffer argument string value is entered in the Expression field, the XPath Building Assistant provides payload as the value for the second String argument:

Double-click payload.

 

8.

After the payload argument value is entered in the Expression field, the XPath Building Assistant provides /ns1:loanOffer as a value for the last String argument:

Double-click /ns1:loanOffer.

 

9.

After the /ns1:loanOffer argument value is entered in the Expression field, the XPath Building Assistant provides a list of child elements from the loanOffer structure:

Double-click ns1:APR to complete the first part of the conditional expression.

 

10. Press [End] to move the cursor after the bpws:getVariableData() function call in the Expression field. To insert the greater-than (>) conditional operator, press [Space] + [>] + [Space]:

 

11.

To complete the conditional branch expression in the Expression field, Press [Ctrl] + [Space] to invoke the XPath Building Assistant to insert the following function call on the right side of the conditional operator:

bpws:getVariableData('starOffer', 'payload', '/ns1:loanOffer/ns1:APR')

Click OK.

 

12.

If the <case> conditional expression is true, its branch is processed. Therefore, the StarLoan loan offer should be selected because it is better than (less than) the UnitedLoan loan offer. To select the starOffer, drag an Assign component to the Drop Activity Here region in the <case> branch:

Double-click Assign_4.

 

13.

To copy the starOffer to the outputVariable, in the Assign properties click the General tab. Enter selectStarOffer in the Name property:

Click the Copy tab, and then click Create to open the Create Copy Rule window.

In the From section of the Create Copy Rule window, populate the following field values:

Variable: starOffer

Part: payload

Leave the XPath Query field empty.

In the To section, populate the following field values:

Variable: outputVariable

Part: payload

Leave the XPath Query field empty.

Click OK to close the Create Copy Rule window.

Click OK to close the Assign property dialog box.

 

14.

To select the unitedOffer in the <otherwise> branch, drag another Assign component to the Drop Activity Here region:

Double-click Assign_4.

 

15.

In the Assign properties, click the General tab. Enter selectUnitedOffer in the Name property:

Click the Copy tab, and then click Create to open the Create Copy Rule window.

In the From section of the Create Copy Rule window, populate the following field values:

Variable: unitedOffer

Part: payload

Leave the XPath Query field empty.

In the To section, populate the following field values:

Variable: outputVariable

Part: payload

Leave the XPath Query field empty.

Click OK to close the Create Copy Rule window.

Click OK to close the Assign property dialog box.

 

16.

Confirm that the switch activity in the ChooseLoanOffer scope contains the selectStarLoan activity in the <case> branch and the selectUnitedLoan activity in the <otherwise> branch:

Select File > Save All to save the changes to the BPEL project.

 

Back to Topic

This section covers the following subtopics:

Deploying the MyLoanProcess BPEL process
Test 1: Successfully Running MyLoanProcess to Obtain a Loan Offer
Test 2: Handling an Exception When Running MyLoanProcess

Back to Topic List

Deploying the MyLoanProcess BPEL process

To deploy the MyLoanProcess BPEL project to the BPEL Process Manager Server, perform the following steps:

1.

In the JDeveloper Applications - Navigator, right-click the MyLoanProcess project node:

Place the cursor over this icon to see the image

Select Deploy > BPEL_conn > Deploy to default domain.

Note: You are using the BPEL Process Manager Server Connection that you created in the first part of this tutorial to deploy the BPEL process. JDeveloper automatically compiles the BPEL process. During compilation, JDeveloper creates a BPEL suitcase in the form of a Java Archive (JAR file), which is deployed to the BPEL Process Manager Server.

 

2.

Track the progress of compiling and deploying the BPEL process in the Messages page of the Messages - Log window:

Place the cursor over this icon to see the image

Note: Make sure that compilation and deployment are successful, before testing the deployed BPEL process. To wrap the message lines in the Messages page, right-click anywhere in the Messages page area and select Wrap from the context menu.

 

Back to Topic

Test 1: Successfully Running MyLoanProcess to Obtain a Loan Offer

To test the success of the MyLoanProcess BPEL process in obtaining a loan offer, perform the following steps:

1.

To view the deployed BPEL process, open a browser window and enter the following URL to display the BPEL Console page:

http://localhost:9700/BPELConsole

Place the cursor over this icon to see the image

A MyLoanProcess link appears under the Deployed BPEL Processes column on the Dashboard page. The BPEL Console can also be started by selecting Start > Programs > Oracle - OracleBPM > Oracle BPEL Process Manager 10.1.2 > BPEL Console.

 

2.

On the Dashboard page, click the MyLoanProcess link:

Place the cursor over this icon to see the image

 

3.

On the Initiate tab of the BPEL Processes page, enter 123454321 in the SSN HTML form field of the loanApplication. Leave all other fields empty:

Place the cursor over this icon to see the image

Click Post XML Message to initiate the BPEL process.

 

4.

On the updated Initiate tab of the BPEL Processes page, click the Visual Flow link:

Place the cursor over this icon to see the image

 

5.

On the Flow tab of the Instances page, scroll down to the end of the page:

Note: The starLoanService (onResult) activity is awaiting manual completion.

 

6.

To manually approve the StarLoan offer, open a new browser window. Enter the following URL to start the StarLoanUI Web application:

http://localhost:9700/StarLoanUI

Click the Assign APR Task link.

 

7.

On the Assign APR Task page of the StarLoanUI Web interface, enter Approve:

The default value of 7.4 in the APR field is greater than the UnitedLoan Web service offer of 5.7. In this case, the UnitedLoan offer is selected by the BPEL process flow.

 

8.

The Assign APR Task has been completed page appears:

Close the browser window.

 

9.

On the browser window containing the BPEL Console Web interface, right-click any white-space area:

Select Refresh to refresh the visual flow on the Instances page .

10.

Scroll to the bottom of the Flow tab on the refreshed Instances page to see that the ChooseLoanOffer scope contains the selectUnitedOffer assign activity:

Click the client (onResult) link or icon, to view the loan offer document that is returned to the client.

11.

The Activity Audit Trail window displays the client (onResult) outputVariable contents:

The value United Loan appears in the <providerName> element, with an APR element value of 5.7.

Close the Activity Audit Trail window.

 

Back to Topic

Test 2: Handling an Exception When Running MyLoanProcess

To test the success of the MyLoanProcess BPEL process in handling the NegativeCredit exception that can be generated from the CreditRatingService, perform the following steps:

1.

Return to the BPEL Console Dashboard page, and then click the Dashboard tab:

Place the cursor over this icon to see the image

 

2.

On the Dashboard page, click the MyLoanProcess link to initiate a new instance of the BPEL process:

Place the cursor over this icon to see the image

 

3.

On the Initiate tab of the BPEL Processes page, enter 012345678 in the SSN HTML form field of the loanApplication. Leave all other fields empty:

Place the cursor over this icon to see the image

The CreditRatingService Web service generates a NegativeCredit fault for a loanApplication whose SSN value starts with a zero.

Click Post XML Message to initiate the BPEL process.

 

4.

On the updated Initiate tab of the BPEL Processes page, click the Visual Flow link:

Place the cursor over this icon to see the image

 

5.

On the Flow tab of the Instances page, scroll down until you can see from the creditRatingService (process) through the terminate activities:

Place the cursor over this icon to see the image

The creditRatingService (process) activity is outlined in red, indicating that a fault occurred.

Click the creditRatingService (process) activity link or icon to examine the fault generated.

 

6.

The Activity Audit Trail window for the creditRatingService (process) shows that the NegativeCredit fault has been thrown:

Place the cursor over this icon to see the image

Note: The <error> element contains the text value Bankruptcy Report.

Close the Activity Audit Trail window.

 

7.

To view the loan offer returned to the client with the loan application not approved, click the client (onResult) link or icon:

Place the cursor over this icon to see the image

 

8.

In the Activity Audit Trail window for the client (onResult) activity, the outputVariable contains a <loanOffer> element containing the <providerName> element with a value of None - rejected because of bad credit, plus the <approved> element with a value of false.

Place the cursor over this icon to see the image

All other child elements of <loanOffer> are set as specified by the Assign_3 activity. The BPEL process has been terminated by the fault handling designed into the process.

Close the Activity Audit Trail window.

 

9.

Close the JDeveloper BPEL Designer.

Close the browser window containing the BPEL Console.

Start a command window to shut down the BPEL Process Manager Server by entering the following commands:

D:
cd \JDeveloper\JDevBPEL\integration\bpm\orabpel\bin
shutdownorabpel.bat
Place the cursor over this icon to see the image

Back to Topic

In this tutorial, you've learned how to:

Create a new BPEL project by using Oracle JDeveloper 10g BPEL Designer

Add partner links for each Web service that is invoked by a BPEL process

Add variables for passing XML data in requests and responses between the Web services and BPEL process

Visually design a BPEL process by using Oracle JDeveloper 10g BPEL Designer
Compile and deploy the BPEL process by using Oracle JDeveloper 10g BPEL Designer
Test the BPEL process in the BPEL Console
Shutdown the BPEL Process Manager Server

Back to Topic List

To ask a question about this OBE tutorial, post a query on the OBE Discussion Forum.
To learn more about Oracle BPEL products, refer to additional OBEs on the OTN Web site.

Back to Topic List

Place the cursor over this icon to hide all screenshots.

 

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy