Skip Headers
Oracle® BPEL Process Manager Quick Start Guide
10g (10.1.3.1.0)

Part Number B28983-01
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
View PDF

2 Credit Flow Tutorial

This tutorial describes how to use Oracle JDeveloper to design, deploy, and test your first BPEL process.

This tutorial contains these topics:

2.1 Credit Flow Introduction

This tutorial teaches you how to use Oracle JDeveloper to build, deploy, and test your first BPEL process. The process is a flow that you create to call a Credit Rating service. When you run this process, you enter your social security number into an HTML user interface. The Credit Rating service takes your number and returns a credit rating. Creating this process is intended to be the first step toward building a more sophisticated application (like that shown in Chapter 3, "Reviewing a Loan Procurement BPEL Process").

2.2 Using the Tutorial

This tutorial contains these topics:

2.2.1 Starting Oracle BPEL Server and Oracle JDeveloper

Ensure that Oracle JDeveloper and Oracle BPEL Server are started. See "Starting and Stopping Oracle BPEL Process Manager Components" for instructions.

2.2.2 Starting and Testing Your Service

During this tutorial, the BPEL process that you design communicates with a Credit Rating service described in "Credit Flow Introduction". You must first start the service and test that it is running.

  1. Select Start > All Programs > Oracle - Oracle_Home > Oracle BPEL Process Manager > Developer Prompt to open up a command prompt at the SOA_Oracle_Home\bpel\samples directory.

  2. Change directories to the utils\CreditRatingService subdirectory:

    cd utils\CreditRatingService
    
    
  3. Enter the following command:

    ant
    
    

    This deploys and starts the Credit Rating service for using this tutorial. If successful, a message similar to the following appears at the end:

    BUILD SUCCESSFUL
    
    
  4. Log in to Oracle Enterprise Manager 10g BPEL Control by selecting Start > All Programs > Oracle - Oracle_Home > Oracle BPEL Process Manager > BPEL Control.

  5. Enter the following details to log in to Oracle Enterprise Manager 10g BPEL Control and click Login:

    Field Value
    Username oc4jadmin
    Password password

    Where password is the value you entered during installation in "Installing Oracle Application Server SOA Suite".

    All services are running if the CreditRatingService, TaskActionHandler, and TaskManager services display in the Dashboard tab.

2.2.3 Creating an Application and a Project

You must create an application and a project to begin. The project automatically creates the basics for your BPEL process, including:

  • BPEL process source (projectname.bpel)

  • Web services description language (WSDL) client interface (projectname.wsdl)

  • BPEL process deployment descriptor (bpel.xml)

Follow these instructions to create a new Credit Flow project.

Caution:

Do not include any special characters in the project name (such as periods). If you do include special characters, errors appear when you attempt to compile your project.
  1. Return to Oracle JDeveloper.

  2. Select File > New from the main menu.

  3. Double-click Application in the Items window to display the Create Application window.

  4. Enter myBPELapplication in the Application Name field and accept the default path in the Directory Name field.

  5. Click OK.

  6. Click Cancel on the Create Project window.

  7. Right-click myBPELapplication in the Application Navigator section.

  8. Select New Project to define a new BPEL process project.

  9. Double-click BPEL Process Project in the Items window to display the BPEL Project Creation Wizard window. If this entry does not appear, first select General > Projects.

  10. Enter myCreditFlow in the Name field. All other fields default to the correct values for creating an asynchronous BPEL process.

  11. Click Finish. The BPEL process files are created in the JDev_Oracle_Home\jdev\mywork\myBPELapplication\myCreditFlow\bpel directory.

  12. The following sections appear. If they do not appear, click Diagram in Oracle JDeveloper and double-click myCreditFlow.bpel in the Application Navigator > Integration Content section. See the Oracle BPEL Process Manager Developer's Guide for a description of Oracle JDeveloper sections.

    Description of creditflowstart.gif follows
    Description of the illustration creditflowstart.gif

2.2.4 Viewing the WSDL File Source Code

You now review the sections of the WSDL file.

  1. Double-click myCreditFlow.wsdl in the Application Navigator section, then click Source at the bottom of the window.

  2. View the following section of code. Two port types are defined, each with a one-way operation. One operation initiates the asynchronous process. The other operation calls back the client with the asynchronous response.

    <portType name="myCreditFlow">
       <operation name="initiate">
          <input message="client:myCreditFlowRequestMessage"/>
       </operation>
    </portType>
    
    <!-- portType implemented by the requester of myCreditFlow BPEL processfor asynchronous callback purposes-->
    <portType name="myCreditFlowCallback">
       <operation name="onResult">
          <input message="client:myCreditFlowResponseMessage"/>
       </operation>
    </portType>
    
    
  3. View the following section of code. The partnerLinkType for this asynchronous process has two roles. One role is for the service provider, and the other is for the requester.

    <plnk:partnerLinkType name="myCreditFlow">
       <plnk:role name="myCreditFlowProvider">
          <plnk:portType name="client:myCreditFlow"/>
       </plnk:role>
       <plnk:role name="myCreditFlowRequester">
          <plnk:portType name="client:myCreditFlowCallback"/>
       </plnk:role>
    </plnk:partnerLinkType>
    

2.2.5 Viewing the BPEL File Source Code

You now review the sections of the BPEL file.

  1. Double-click myCreditFlow.bpel.

  2. Click Source at the bottom of the designer window.

  3. View the following section of code. The partnerLink created for the client interface includes two roles, myRole and partnerRole. An asynchronous BPEL process typically has two roles for the client interface: one for the flow itself, which exposes an input operation, and one for the client, which gets called back asynchronously.

    <partnerLinks>   <partnerLink name="client" partnerLinkType="client:myCreditFlow"
       myRole="myCreditFlowProvider" partnerRole="myCreditFlowRequester"/></partnerLinks>
    
    
  4. View the following section of code. The <receive> activity in the main body of the process is followed by an <invoke> activity to perform an asynchronous callback to the requester. Note the difference between this and a synchronous process, which uses a <reply> activity to respond synchronously to the caller.

    <sequence name="main">
    
        <!-- Receive input from requestor. 
        Note: This maps to operation defined in myCreditFlow.wsdl
        -->
        <receive name="receiveInput" partnerLink="client"
     portType="client:myCreditFlow" operation="initiate" variable="inputVariable"
     createInstance="yes"/>
    
        <!-- Asynchronous callback to the requester.
         Note: the callback location and correlation id is transparently handled 
         using WS-addressing.
         -->
        <invoke name="callbackClient" partnerLink="client"
     portType="client:myCreditFlowCallback" operation="onResult"
     inputVariable="outputVariable"/>
      </sequence>
    </process>
    
    
  5. Click Diagram. You are now ready to design your BPEL process.

2.2.6 Editing the XSD File

When you created the BPEL project, a default XSD file was created.

  1. Expand myCreditFlow > Integration Content > Schemas in the Application Navigator.

  2. Double-click myCreditFlow.xsd.

    Description of schema.gif follows
    Description of the illustration schema.gif

  3. Click Source.

    A myCreditFlowProcessRequest element is accepted as input. A myCreditFlowProcessResponse element is returned as output.

    <schema attributeFormDefault="unqualified"
          elementFormDefault="qualified"
          targetNamespace="http://xmlns.oracle.com/myCreditFlow"
          xmlns="http://www.w3.org/2001/XMLSchema">
          <element name="myCreditFlowProcessRequest">
                <complexType>
                      <sequence>
                            <element name="input" type="string"/>
                      </sequence>
                </complexType>
          </element>
          <element name="myCreditFlowProcessResponse">
                <complexType>
                      <sequence>
                            <element name="result" type="string"/>
                      </sequence>
                </complexType>
          </element>
    </schema>
    
    

    You now edit the input and output messages of the WSDL file. This WSDL file represents the user interface with which you interact when you run your BPEL process and request a credit rating in"Running the Credit Flow Process".

  4. Click Design.

    A graphical view of the XSD file displays in the design window. In the Structure section at the lower left, the elements of the XSD file display for editing when fully expanded.

    Description of schema2.gif follows
    Description of the illustration schema2.gif

  5. Double-click the first element - input in the Structure window to display the element Properties window.

  6. Change input to ssn.

  7. Click OK.

  8. Double-click the second element - result in the Structure window to display the element Properties window.

  9. Change result to creditRating.

  10. Click the Advanced Properties tab.

  11. Go to the type section and note it says string.

  12. Click string.

  13. Click ... to the right of string to display the type window.

  14. Replace string with int in the Name field as the output to be returned.

  15. Click OK to close the type window and the element Properties window.

    Your changes display in the design view of the XSD file.

    Description of schema3.gif follows
    Description of the illustration schema3.gif

  16. Select Save from the File main menu.

  17. Close the XSD file by clicking the x in myCreditFlow.xsd at the top of the designer window.

  18. Double-click myCreditFlow.bpel in the Application Navigator section.

  19. Click Diagram.

2.2.7 Validating Your Project During the Design Phase

As you design your BPEL project, small yellow flags can display above activities. You may have correctly configured these activities; they simply may not yet have been validated.

  1. Click Validate above the designer window to validate your process.

    Figure 2-1 Validating a Process

    Description of Figure 2-1 follows
    Description of "Figure 2-1 Validating a Process"

    If the activity correctly validates, the flag disappears.

  2. If the yellow flag remains, you may have validation errors in activities or your process design is not yet complete.

  3. Click the yellow flag above the activity to display details about the validation error and corrective actions to follow.

    Note:

    When you deploy a process, as described in "Validating, Compiling, and Deploying the Credit Flow Process", your process is automatically validated, compiled, and, if successful, deployed together.

2.2.8 Creating and Configuring a Partner Link for the Credit Rating Service

You now create and configure a partner link for the synchronous Credit Rating service.

This section contains these tasks:

2.2.8.1 Creating a Credit Rating Service Partner Link

Summary:

Partner links define the external services with which your BPEL process interacts. You must create a partner link for the Credit Rating service.
  1. Ensure that Services is selected in the drop-down list of the Component Palette section in the upper right part of Oracle JDeveloper.

  2. Drag and drop a PartnerLink activity under the Services section on the right side of Oracle JDeveloper.

    The Create Partner Link window appears.

  3. Enter the following values to create a partner link for the Credit Rating service:

    Note:

    For the WSDL File field below, click the flashlight (the second icon from the left named Service Explorer) to access the Service Explorer window shown below for automatically selecting the Credit Rating service deployed in "Starting and Testing Your Service".
    Description of creditratingwsdl.gif follows
    Description of the illustration creditratingwsdl.gif

    Field Value
    Name CreditRatingService
    WSDL File Access this URL by clicking the Service Explorer flashlight icon and expanding and selecting BPEL Services > my_integration_server_connection > processes > default > CreditRatingService.

    where my_integration_server_connection is the server connection name you specified in Step 17.

    http://localhost:8888/orabpel/default/CreditRatingService/CreditRatingService?wsdl

    See Also: "Verifying the Hostname in Your Web Browser Preferences" if you receive a parsing error when attempting to add a WSDL file in the Service Explorer window.

    Partner Link Type CreditRatingService
    Partner Role CreditRatingServiceProvider
    My Role Leave unspecified. Because this is a synchronous partner link, no role is required.

  4. Click OK.

    The CreditRatingService partner link appears on the right side of the design window. Description of creditflowplink.gif follows
    Description of the illustration creditflowplink.gif

  5. Select Save from the File main menu.

2.2.8.2 Creating a Scope Activity

Summary:

You first create a Scope activity in this section. A Scope activity consists of a collection of activities that can have their own local variables, fault handlers, and so on. A Scope activity is analogous to a { } block in a programming language.

Within this Scope activity, the client's credit rating background is identified.

  1. Go to the Component Palette section and select Process Activities.

  2. Drag and drop a Scope activity between the receiveInput and callbackClient activities.

  3. Double-click the Scope activity to display the Scope window.

  4. Enter GetCreditRating in the Name field of the General tab.

  5. Click OK.

  6. Select Save from the File main menu.

2.2.8.3 Creating an Invoke Activity Inside the Scope Activity

Summary:

You create an Invoke activity in this section. An Invoke activity enables you to specify the operation you want to invoke for the service (identified by its partner link).

This Invoke activity provides the initial interaction operation between the client and the Credit Rating service.

  1. Click the + sign to expand the GetCreditRating Scope activity.

  2. Drag and drop an Invoke activity from the Component Palette section into the GetCreditRating Scope activity.

  3. Double-click the Invoke icon to display the Invoke window.

  4. Enter the following details:

    Field Value
    Name invokeCRS
    Partner Link CreditRatingService

    The Operation (process) field is automatically filled in.

  5. Click the first icon to the right of the Input Variable field. This is the automatic variable creation icon.

    Description of autocreate.gif follows
    Description of the illustration autocreate.gif

  6. Click OK on the Create Variable window that appears.

    A variable named invokeCRS_process_InputVariable is automatically created in the Input Variable field. This variable is automatically assigned a message type of CreditRatingServiceRequestMessage.

  7. Click the first icon to the right of the Output Variable field.

  8. Click OK on the Create Variable window that appears.

    A variable named invokeCRS_process_OutputVariable is automatically created in the Output Variable field. This variable is automatically assigned a message type of CreditRatingServiceResponseMessage.

  9. Click OK.

  10. Select Save from the File main menu.

2.2.8.4 Creating an Initial Assign Activity Inside the Scope Activity

Summary:

In this section you create the first of two Assign activities in this tutorial. An Assign activity provides a method for simple data manipulation, such as copying the contents of one variable to another.

This Assign activity takes the client's social security number as input and contacts the Credit Rating service to assign a credit rating.

  1. Drag and drop an Assign activity from the Component Palette section to above the invokeCRS Invoke activity.

    Description of creditflowassign.gif follows
    Description of the illustration creditflowassign.gif

  2. Double-click the Assign icon to display the Assign window.

  3. Enter assignSSN in the Name field of the General tab.

  4. Click Apply.

  5. Click the Copy Operation tab.

  6. Click Create and select Copy Operation to display the Create Copy Operation window.

  7. Enter the following values:

    Field Value
    From
    • Type
    Variable
    • Variables
    Expand and select Variables > inputVariable > payload > client:myCreditFlowProcessRequest > client:ssn

    Note: The namespace number values (for example, ns1, ns2) can vary. Use the namespace values that automatically appear.

    To
    • Type
    Variable
    • Variables
    Expand and select Variables > invokeCRS_process_InputVariable > payload > ns1:ssn

  8. Click OK to close the Create Copy Operation window and the Assign window.

  9. Select Save from the File main menu.

2.2.8.5 Creating a Second Assign Activity Inside the Scope Activity

Summary:

This Assign activity returns details about the client's assigned credit rating.
  1. Drag and drop a second Assign activity from the Component Palette section to below the invokeCRS Invoke activity within the GetCreditRating Scope activity.

  2. Double-click the Assign icon to display the Assign window.

  3. Enter assignCreditRating in the Name field of the General tab.

  4. Click Apply.

  5. Click the Copy Operation tab.

  6. Click Create and select Copy Operation to display the Create Copy Operation window.

  7. Enter the following values:

    Field Value
    From
    • Type
    Variable
    • Variables
    Expand and select Variables > invokeCRS_process_OutputVariable > payload > ns1:rating

    Note: The namespace number values (for example, ns1, ns2) can vary. Use the namespace values that automatically appear.

    To
    • Type
    Variable
    • Variables
    Expand and select Variables > outputVariable > payload > client:myCreditFlowProcessResponse > client:creditRating

  8. Click OK to close the Create Copy Operation window and the Assign window.

    The Scope activity looks as follows:

    Description of creditratingscope.gif follows
    Description of the illustration creditratingscope.gif

  9. Select Save from the File main menu.

    You have now completed the Credit Rating service design and are ready to proceed to the validation, compilation, and deployment tasks described in the following section.

2.2.9 Validating, Compiling, and Deploying the Credit Flow Process

You are now ready to deploy your BPEL process.

  1. Go to the Application Navigator section.

  2. Right-click myCreditFlow.

  3. Select Deploy > my_integration_server_connection > Deploy to default domain.

    where my_integration_server_connection is the integration server connection name you specified in Step 17.

  4. Click OK.

    This compiles the BPEL process. Review the bottom of the window for any errors. If there are no errors, the following message appears:

    BUILD SUCCESSFUL
    
    
  5. Check for errors by clicking the buttons at the bottom of the window. Errors that do not display under the Messages button can sometimes appear under the Apache Ant button.

    If there are no errors, deployment was successful. If there are errors, double-click the error to display details about the type and location of the error.

  6. Make corrections and deploy again.

2.2.10 Running the Credit Flow Process

You are now ready to begin the process of applying for and receiving a loan offer.

  1. Log in to Oracle Enterprise Manager 10g BPEL Control by selecting Start > All Programs > Oracle - Oracle_Home > Oracle BPEL Process Manager > BPEL Control.

  2. Enter the following details to log in to Oracle Enterprise Manager 10g BPEL Control:

    Field Value
    Username oc4jadmin
    Password password

    The Dashboard tab of Oracle Enterprise Manager 10g BPEL Control appears.

  3. Click myCreditFlow in the Deployed BPEL Processes list.

  4. Enter a nine-digit integer value that does not begin with zero in the ssn field of the HTML Form and click Post XML Message. Note that the name ssn that displays in the user interface is the value you entered in "Editing the XSD File".

    The BPEL Processes tab displays a message similar to the following:

    Test Instance Initiated
    
    Instance '39e706a46ad531be:858bf1:fcc240f310:-7ffc' is being processed asynchronously.
    
    
  5. Click Visual Flow to view a visual audit trail of the current state of the process instance.

    Description of visualaudit.gif follows
    Description of the illustration visualaudit.gif

    An audit trail displaying the current state of the process appears. It indicates that you have successfully invoked the Credit Rating service.

  6. Click callbackClient in the audit trail to see the results of the loan offer, including the credit rating returned (560) by the Credit Rating service to the client.

    Description of creditratingassign.gif follows
    Description of the illustration creditratingassign.gif

  7. Click the Audit link at the top to observe additional information.

    Description of auditflow.gif follows
    Description of the illustration auditflow.gif