Orchestrating a Simple Process Using Oracle BPEL Process Manager
Orchestrating a Simple Process Using Oracle BPEL Process
Manager
This lab covers the use of Oracle JDeveloper 10g
BPEL Designer to invoke the United Loan, Star Loan, and Credit Rating Web services.
This lab uses JDeveloper to create a BPEL process called MyLoanProcess.
Approximately 40 minutes
This lab covers the following topics:
Place the cursor over this icon to load and view all
the screenshots for this lab. (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.
This lab 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 a document for acceptance or processing by the client.
Back to Topic List
Before starting this lab, you should:
| 1. |
Set Internet Explorer 6.0 as the default browser.
|
| 2. |
Install Oracle JDeveloper BPEL Designer and the Oracle
BPEL PM Server into a directory called D:\JDeveloper\JDevBPEL.
|
| 3. |
Start the Oracle BPEL PM Server as follows:
Start > Programs > Oracle - OracleBPM > Oracle BPEL Process Manager
10.1.2 > Start BPEL PM Server
|
| 4. |
Start the Oracle JDeveloper 10g BPEL Designer
as follows:
Start > Programs > Oracle - OracleBPM > Oracle BPEL Process
Manager 10.1.2 > BPEL Designer
You can also start Oracle JDeveloper 10g BPEL
Designer by double-clicking the desktop icon labeled BPEL Designer.

Add your machine name to JDeveloper proxy settings.
This will enable reading WSDL files from the local machine. Go to Tools
> Preferences > Web Browser and Proxy and enter
the machine name in the Exceptions field.
|
| 5. |
Deploy the CreditRatingService, StarLoan, and UnitedLoan
Web services to the Oracle BPEL PM Server. Launch
the command window as follows:
Start > Programs > Oracle - OracleBPM > Oracle BPEL Process
Manager 10.1.2 > Developer Prompt
Enter the following commands in the command window:
cd utils\CreditRatingService
obant
cd ..\AsyncLoanService obant
|
| 6. |
In the BPEL Console, verify that the CreditRatingService,
StarLoan, and UnitedLoan Web services have been deployed. To start
BPEL Console, select Start > Programs > Oracle - OracleBPM
> Oracle BPEL Process Manager 10.1.2 > BPEL Console. Enter
the default password, bpel, when prompted. The BPEL Console shows
the Web service names in the Deployed BPEL Process column
on the Dashboard page.

Note: If IE 6.0 is not the default browser then, explicitly start
IE 6.0 and enter the URL http://<hostname.domain>:9700/BPELConsole
to start the BPEL Console.
|
| 7. |
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
To create a new BPEL project, perform the following
steps:
| 1. |
In the Oracle JDeveloper 10g BPEL Designer menu, select File
> New.

|
| 2. |
In the New Gallery window, click the General
category and select the Workspace item. Click OK.
|
| 3. |
In the Create Workspace dialog box, apply the following
field values.
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.

|
| 6. |
In the New Gallery window, click Projects
under General and select the BPEL Process Project
item. Click OK.

|
| 7. |
In the BPEL Process Project dialog box, enter the following
values:
Click OK.

|
| 8. |
In the Navigator, the following three files are created:

JDeveloper automatically opens MyLoanProcess.bpel on the Diagram View page. The initial BPEL process activities
are shown on the Diagram View page. You can use this page to graphically
create and edit the BPEL process.

Select File > Save All to save the new project files.
|
| 9. |
Import the LoanFlow.xsd XML Schema document. 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.
To import an XML Schema document into the BPEL project directory, select
Project Schemas in the Structure pane
(MyLoanProcess.bpel must
be selected in the Applications - Navigator.) Click Import.

|
| 10. |
In the Import Schema dialog box, click the Browse
File System icon.

In the Open dialog navigate to the C:\Hands_on_Labs\bpel_jdev\support_files directory (or the temporary directory into which you downloaded the file)
and click Open. Select LoanFlow.xsd.

|
| 11. |
Click OK to close the Import Schema dialog box.

|
| 12. |
In the Structure pane observe that the LoanFlow.xsd file appears under
the Project Schema.

You can also check this in the Applications - Navigator.

Select File > Save All to save the changes to the
project and workspace.
|
| 13. |
In the Structure pane, expand the Message Types node by clicking
the '+' sign. Expand Process WSDL - MyLoanProcess.wsdl and select
MyLoanProcessRequestMessage.

Click Edit.

|
| 14. |
In the Edit Message Type - MyLoanProcessRequestMessage
window, select payload. Click Edit.

|
| 15. |
In the Edit Message Part - payload window, select Element. Click the Browse Elements icon.

|
| 16. |
In the Type Chooser window, expand Project Schema
Files, expand LoanFlow.xsd, and select loanApplication.
Click OK.

|
| 17. |
In the Edit Message Part - payload window, click OK.

|
| 18. |
In the Edit Message Type - MyLoanProcessRequestMessage
window, click OK.

|
| 19. |
To set the response message type for the BPEL process, select MyLoanProcessResponseMessage
in the Structure pane. Click Edit.

|
| 20. |
In the Edit Message Type - MyLoanProcessResponseMessage
window for the response message, select payload. Click Edit.

|
| 21. |
In the Edit Message Part - payload window, select Element.
Click the Browse Elements
icon.

|
| 22. |
In the Type Chooser window, expand Project Schema
Files, expand LoanFlow.xsd, and select loanOffer.
Click OK.

|
| 23. |
To close the Edit Message Part - payload window, click
OK. In the Edit Message Type - MyLoanProcessResponseMessage
window, click OK.

|
Back to Topic List
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.
|
| 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.

|
| 3. |
In the Create Partner Link window, click the WSIL
Browser icon
to open the WSDL Chooser.

|
| 4. |
In the WSDL Chooser window, expand the LocalBPELServer,
processes, and default nodes. Select
CreditRatingService. 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 |
Click OK.

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
to open the WSDL Chooser. In the WSDL Chooser, expand
LocalBPELServer, processes, and
default nodes and select UnitedLoan. Click OK.

|
| 8. |
In the Create Partner Link window for the UnitedLoan
Web service, 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: 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
to open the WSDL Chooser. In the WSDL Chooser, expand
LocalBPELServer, processes,
and default nodes. Select StarLoan. Click OK.

|
| 11. |
In the Create Partner Link window for the StarLoan
Web service, 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: 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 List
To create variables for activities in the MyLoanProcess
BPEL process, perform the following steps:
| 1. |
In the MyLoanProcess.bpel - Structure pane, expand Variables, Process,
and Variables to view two variables defined as inputVariable
and outputVariable.

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

|
| 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.
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. In the Create
Variable window, 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. In the Create
Variable window, 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. In the Create
Variable window, 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. In the Create
Variable window, 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. In the Create Variable
window, 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
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:
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.

|
| 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. 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 Rules page.

|
|
6.
|
In the Create Copy Rule
window, select Variable as Type for both From and To sections. (This
is the default.)
In the From section, expand
Process, Variables, inputVariable, payload,
ns1:loanApplication, and select ns1:SSN.

In the To section, expand Process,
Variables, crInput, payload, and select ns2:ssn.
Observe the XPath Query for the chosen variables
in the corresponding XPath fields. Click OK to save the
copy rule settings.

|
| 7. |
Check the new copy rule details in the Assign properties
section. Click OK. The Invalid Settings error
message is cleared if the details entered are valid.

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

|
| 9. |
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.
Click OK.

|
| 10. |
Drag another Assign activity from the Component
Palette to the GetCreditRating
Scope after the invokeCR activity.

|
| 11. |
Double-click the Assign_2 activity. To add a copy rule,
click Create.

|
| 12. |
In the Create Copy Rule
window, select Variable as Type for both From and To sections (This
is the default.)
In the From section, expand
Process, Variables, crOutput, payload, and
select ns2:rating.

In the To section, expand Process,
Variables, loanApplication, payload, ns1:loanApplication,
and select ns1:creditRating.
Observe the XPath Query for the chosen variables
in the corresponding XPath fields. Click OK to save the
copy rule settings.

|
| 13. |
Check the new copy rule details in the Assign properties
section. Click OK. The Invalid Settings error
message is cleared if the details entered are valid.

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 Catch page, click the Browse Faults
icon to choose the fault variable.
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.

|
| 4. |
In the Fault Chooser dialog box, expand Partner Links, creditRatingService,
CreditRatingService, and select Fault - NegativeCredit.
Click OK.

|
| 5. |
For Fault Variable, click the Browse Faults
icon and choose crError. Click OK.

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

|
| 7. |
To add the copy rules needed to indicate that the loan offer is not approved
in the outputVariable,
double-click Assign_3. Click Create.
|
| 8. |
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:

|
| 9. |
In the To section, expand Process, Variables,
outputVariable, payload, ns1:loanOffer, and select
ns1:providerName. Click OK.

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

|
| 11. |
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.

|
| 12. |
In the To section, expand Process, Variables,
outputVariable, payload, ns1:loanOffer, and select
ns1:selected. Click OK.

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

|
| 14. |
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.

|
| 15. |
In the To section, expand Process, Variables,
outputVariable, payload, ns1:loanOffer, and select
ns1:approved. Click OK.

|
| 16. |
In the Assign properties section, click Create
to add the fourth and last copy rule.

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

|
| 18. |
In the To section, expand Process, Variables,
outputVariable, payload, ns1:loanOffer, and select
ns1:APR. Click OK.

|
| 19. |
Verify that there are four copy rules in the Assign
properties. Click OK.

|
| 20. |
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.

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

|
| 22. |
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
at 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.

|
| 3. |
Expand the GetLoanOffers scope. 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 Rules tab.

Click Create.

|
| 5. |
In the Create Copy Rule
window, select Variable as Type for both the From and To sections. (This
is the default.)
In the From section, expand
Process, Variables, inputVariables, and select payload.

In the To section, expand Process,
Variables, loanApplication, and select payload. Click
OK.

Click OK.

|
| 6. |
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.

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

|
| 8. |
Double-click Invoke_1, and then set the following Invoke
properties.
 |
Name: invokeUnitedLoan
|
 |
Partner Link: unitedLoanService | | |