Skip Headers
Oracle® SOA Suite Tutorial
Release 3 (10.1.3.1.0)

Part Number B28937-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

7 Creating the SelectManufacturer Project

This chapter describes how to create the SelectManufacturer project. It contains these sections:

7.1 About the SelectManufacturer Project

The SelectManufacturer project represents a supplier called Select Manufacturer. When a customer places an order, the order is sent to two suppliers, Select Manufacturer and Rapid Distributors, to get quote requests from both suppliers. The supplier that responds with the lower quote gets to fulfill the customer's order.

The SelectManufacturer project is an asynchronous BPEL process. This means that it contains a receive activity to initiate the BPEL process flow and an invoke activity to call back the client asynchronously with the results (that is, the quote) at the end of the flow.

7.2 Create a New BPEL Project for SelectManufacturer

  1. Right-click the SOADEMO application in the Application Navigator and select New Project to display the New Gallery.

  2. In the New Gallery, under Categories, expand General and select Projects. Under Items, select BPEL Process Project.

    Figure 7-1 New Gallery for SelectManufacturer Project

    Description of Figure 7-1 follows
    Description of "Figure 7-1 New Gallery for SelectManufacturer Project"

    Click OK. This displays the BPEL Project Creation wizard.

  3. On the Project Settings page of the BPEL Project Creation wizard:

    • Name: enter SelectManufacturer.

    • Namespace: enter http://www.globalcompany.com/ns/selectservice.

    • Use Default Project Settings: select this option.

    • Template: select Empty BPEL Process.

    Figure 7-2 BPEL Project Creation Wizard - Project Settings Page

    Description of Figure 7-2 follows
    Description of "Figure 7-2 BPEL Project Creation Wizard - Project Settings Page"

    Click Finish.

7.3 Create "SelectService" Partner Link

  1. Copy the SelectManufacturer\bpel\SelectManufacturer.wsdl file from the soademo_101310_prod.zip file to the SOADEMO\SelectManufacturer\bpel directory.

  2. Select View > Component Palette to display the Component Palette. You need the Component Palette to drag and drop BPEL activities and services onto the SelectManufacturer BPEL flow you are about to create.

  3. Select Services from the dropdown in the Component Palette.

  4. Drag the Partner Link icon from the Component Palette and drop it on a Services swimlane. You can drop it on either the left side or the right side.

  5. In the Partner Link dialog:

    • Name: enter SelectService.

    • WSDL: click the Service Explorer icon (the second one from the left) to display the Service Explorer dialog. In the Service Explorer dialog, expand Project WSDL Files and select SelectManufacturer.wsdl.

      Figure 7-3 Service Explorer Dialog for SelectService

      Description of Figure 7-3 follows
      Description of "Figure 7-3 Service Explorer Dialog for SelectService"

      Click OK in the Service Explorer dialog.

    • Partner Link Type: select SelectService_PL (automatically filled in for you).

    • Partner Role: select SelectServiceRequester.

    • My Role: select SelectServiceProvider.

    Figure 7-4 Create Partner Link Dialog for SelectService

    Description of Figure 7-4 follows
    Description of "Figure 7-4 Create Partner Link Dialog for SelectService"

  6. Click OK in the Create Partner Link dialog.

At this point, the SelectManufacturer.bpel page should look like this:

Figure 7-5 SelectManufacturer.bpel Page in JDeveloper

Description of Figure 7-5 follows
Description of "Figure 7-5 SelectManufacturer.bpel Page in JDeveloper"

7.4 Define Variables for the SelectManufacturer Project

In this step, you create two variables called inputVariable and outputVariable for the SelectManufacturer project. Variables defined at the project level can be accessed by all activities in the project.

  1. Double-click the SelectManufacturer scope to display the Process dialog. You can double-click the "SelectManufacturer" text that is displayed sideways.

  2. In the Process dialog, click the Variables tab.

    Figure 7-6 Process Dialog, Variables Tab, for SelectManufacturer

    Description of Figure 7-6 follows
    Description of "Figure 7-6 Process Dialog, Variables Tab, for SelectManufacturer"

  3. Create a variable called inputVariable.

    1. Click Create to display the Create Variable dialog.

    2. In the Create Variable dialog, set these values:

      • Name: enter inputVariable.

      • Type: select Message Type, and click the flashlight icon. This displays the Type Chooser dialog.

        In the Type Chooser, select Type Explorer > Message Types > Partner Links > SelectService > SelectManufacture.wsdl > Message Types > RequestQuote_processRequestQuote.

        Figure 7-7 Type Chooser for inputVariable

        Description of Figure 7-7 follows
        Description of "Figure 7-7 Type Chooser for inputVariable"

      Click OK in the Type Chooser. The Create Variable dialog now looks like this:

      Figure 7-8 Create Variable Dialog for inputVariable

      Description of Figure 7-8 follows
      Description of "Figure 7-8 Create Variable Dialog for inputVariable"

    3. Click OK in the Create Variable dialog. This returns you to the Process dialog. You should see the inputVariable in the dialog.

  4. Create a second variable called outputVariable.

    1. Click Create to display the Create Variable dialog.

    2. In the Create Variable dialog, set these values:

      • Name: enter outputVariable.

      • Type: select Message Type, and click the flashlight icon. This displays the Type Chooser dialog.

        In the Type Chooser, select Type Explorer > Message Types > Partner Links > SelectService > SelectManufacture.wsdl > Message Types > RequestQuote_processRequestQuoteResponse.

        Figure 7-9 Type Chooser for outputVariable

        Description of Figure 7-9 follows
        Description of "Figure 7-9 Type Chooser for outputVariable"

      Click OK in the Type Chooser. The Create Variable dialog now looks like this:

      Figure 7-10 Create Variable Dialog for outputVariable

      Description of Figure 7-10 follows
      Description of "Figure 7-10 Create Variable Dialog for outputVariable"

    3. Click OK in the Create Variable dialog.

  5. In the Process dialog, you should see the two variables:

    Figure 7-11 Process Dialog Showing inputVariable and outputVariable

    Description of Figure 7-11 follows
    Description of "Figure 7-11 Process Dialog Showing inputVariable and outputVariable"

  6. Click OK in the Process dialog.

  7. Select File > Save to save your work.

7.5 Receive Order Data from the Client through a Receive Activity

Create a receive activity as the starting point for this BPEL process. The receive activity receives requests from clients (in this case, the client is the SOAOrderBooking project, which is another BPEL process), and the requests can contain parameters.

  1. Select Process Activities from the dropdown in the Component Palette.

  2. Drag the Receive activity icon from the Component Palette and drop it in the "Drop Activity Here" box on the page.

  3. Drag an arrow from the newly created receive activity and drop it on the SelectService partner link. As you drag, you should see a line connecting the receive activity with partner link. When you release, JDeveloper displays the Receive dialog.

  4. In the Receive dialog:

    • Name: enter Receive_1.

    • Partner Link: should be set to SelectService. This should be filled in automatically for you.

    • Operation: should be set to processRequestQuote. This should be filled in automatically for you.

    • Variable: click the Browse Variables icon (the icon on the right) to display the Variable Chooser dialog. Select inputVariable.

      Figure 7-12 Variable Chooser Dialog

      Description of Figure 7-12 follows
      Description of "Figure 7-12 Variable Chooser Dialog"

      Click OK in the Variable Chooser.

    • Create Instance: select this option.

    The Receive dialog now looks like this:

    Figure 7-13 Receive Dialog

    Description of Figure 7-13 follows
    Description of "Figure 7-13 Receive Dialog"

  5. Click OK in the Receive dialog.

    The SelectManufacturer.bpel page now contains a link from the SelectService partner link to the receive activity.

    Figure 7-14 SelectManufacturer.bpel Showing Link from SelectService Partner Link to the Receive Activity

    Description of Figure 7-14 follows
    Description of "Figure 7-14 SelectManufacturer.bpel Showing Link from SelectService Partner Link to the Receive Activity"

  6. Select File > Save to save your work.

7.6 Assign Values to be Returned

In this assign activity, you set the values that are returned by Select Manufacturer when it is asked for a quote. To simplify things in this SOA Order Booking application, the SelectManufacturer BPEL process returns two values:

These values are set in the outputVariable variable, which will be returned to the client.

  1. Select Process Activities from the dropdown in the Component Palette.

  2. Drag the Assign activity icon from the Component Palette and drop it after the Receive_1 activity.

  3. Double-click the new Assign instance to display the Assign dialog.

  4. Click the Copy Operation tab in the Assign dialog.

  5. In the Copy Operation tab, create the first copy operation. This copy operation sets the quote value to return.

    1. Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.

    2. In the Create Copy Operation dialog:

      • On the From side, select Expression from the Type dropdown. Enter the following into the Expression box:

        120 * bpws:getVariableData('inputVariable','parameters',
        '/client:processRequestQuoteElement/client:param0/client:quantity')
        
        

        This formula multiplies the number of items in the order by 120 to get the quote price.

      • On the To side, select Variable from the Type dropdown. Select Variables > Process > Variables > outputVariable > parameters > client:processRequestQuoteResponseElement > client:return > client:supplierPrice. Note that the prefix ("client") may be different on your machine.

      The Create Copy Variable dialog should look like this:

      Figure 7-15 Create Copy Variable Dialog for Returning the Supplier Price

      Description of Figure 7-15 follows
      Description of "Figure 7-15 Create Copy Variable Dialog for Returning the Supplier Price"

    3. Click OK in the Create Copy Operation dialog.

  6. Create the second copy operation. This copy operation sets the name to return.

    1. Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.

    2. In the Create Copy Operation dialog:

      • On the From side, select Expression from the Type dropdown. Enter the following into the Expression box:

        string('SelectDistributors')
        
        
      • On the To side, select Variable from the Type dropdown. Select Variables > Process > Variables > outputVariable > parameters > client:processRequestQuoteResponseElement > client:return > client:supplierName.

      The Create Copy Variable dialog should look like this:

      Figure 7-16 Create Copy Variable Dialog for Returning the Supplier Name

      Description of Figure 7-16 follows
      Description of "Figure 7-16 Create Copy Variable Dialog for Returning the Supplier Name"

    3. Click OK in the Create Copy Operation dialog.

      The Assign dialog should look like this:

      Figure 7-17 Assign Dialog

      Description of Figure 7-17 follows
      Description of "Figure 7-17 Assign Dialog"

  7. Click OK in the Assign dialog.

  8. Select File > Save to save your work.

The SelectManufacturer.bpel page should now look like this:

Figure 7-18 SelectManufacturer.bpel Page Showing the Assign Activity

Description of Figure 7-18 follows
Description of "Figure 7-18 SelectManufacturer.bpel Page Showing the Assign Activity"

7.7 Return Values to the Client Using an Invoke Activity

The Invoke activity returns the values in the outputVariable to the client.

  1. Select Process Activities from the dropdown in the Component Palette.

  2. Drag the Invoke activity icon from the Component Palette and drop it after the Assign_1 activity.

  3. Drag an arrow from the newly created invoke activity and drop it on the SelectService partner link. This displays the Invoke dialog.

  4. In the Invoke dialog:

    • Name: enter Invoke_1.

    • Partner Link: should be set to SelectService.

    • Operation: select processRequestQuoteResponse. This is set for you automatically.

    • Input Variable: click the Browser Variables icon (the one on the right) to display the Variable Chooser. In the Variable Chooser, select Variables > Process > Variables > outputVariable.

      Figure 7-19 Variable Chooser for the Input Variable

      Description of Figure 7-19 follows
      Description of "Figure 7-19 Variable Chooser for the Input Variable"

      Click OK in the Variable Chooser.

    The Invoke dialog should now look like this:

    Figure 7-20 Invoke Dialog

    Description of Figure 7-20 follows
    Description of "Figure 7-20 Invoke Dialog"

  5. Click OK in the Invoke dialog.

  6. Select File > Save to save your work.

The SelectManufacturer.bpel page now looks like this:

Figure 7-21 SelectManufacturer.bpel Page with Invoke Activity

Description of Figure 7-21 follows
Description of "Figure 7-21 SelectManufacturer.bpel Page with Invoke Activity"

7.8 Deploy the BPEL Process

  1. Double-click build.properties, located under SelectManufacturer > Resources in the Application Navigator. This file defines values that are used by build.xml when you deploy the BPEL project.

  2. Uncomment (by removing the # character) these lines in the build.properties file:

    platform=ias_10g
    domain=default
    rev=1.0
    admin.user=oc4jadmin
    admin.password=welcome99
    http.hostname=myAppServerMachine.mydomain.com
    http.port=8888
    j2ee.hostname=myAppServerMachine.mydomain.com
    rmi.port=23793
    opmn.requestport=6005
    oc4jinstancename=home
    
    
  3. Edit the values as necessary. The values in bold italics are the typical values you need to modify.

    To determine the value for rmi.port, run:

    ORACLE_HOME\opmn\bin\opmnctl status -l
    
    

    ORACLE_HOME specifies the Oracle home for Oracle Application Server.

    To determine the value for opmn.requestport, see step 6.

  4. Select File > Save to save your changes to build.properties.

  5. Right-click build.xml (located under SelectManufacturer > Resources) and select Run Ant.

  6. In the Run Ant dialog, click the Properties tab.

  7. In the Property Files section, click Add. In the Add Ant Property File dialog, select the build.properties file in the SelectManufacturer directory and click Open.

    The Run Ant dialog should look like this:

    Figure 7-22 Run Ant Dialog, Properties Tab, With build.properties File Loaded

    Description of Figure 7-22 follows
    Description of "Figure 7-22 Run Ant Dialog, Properties Tab, With build.properties File Loaded"

  8. Click OK. JDeveloper runs Ant to compile and deploy the project. If you get errors, see the next section, Section 7.8.1, "Deploying Using Ant from the Developer Prompt".

7.8.1 Deploying Using Ant from the Developer Prompt

If you get errors, check that the values you entered in the build.properties file are correct.

If the values are correct, but you still get errors, you can run ant from the Developer Prompt to deploy the project:

  1. On the machine running Oracle Application Server, select Start > Programs > Oracle - instanceName > Oracle BPEL Process Manager > Developer Prompt. This displays a shell window configured for Oracle BPEL Process Manager.

    Note that you must run ant from the Developer Prompt shell window to deploy the SelectManufacturer project. Running ant from a regular operating system shell for deploying the project is not supported.

  2. In the Developer Prompt window, change directory to the SOADEMO\SelectManufacturer directory, where SOADEMO refers to the directory where you created the SOA Order Booking application.

    > cd SOADEMO
    > cd SelectManufacturer
    
    

    If you are running JDeveloper and Oracle Application Server on separate machines, you can copy the SelectManufacturer directory from the JDeveloper machine to the Oracle Application Server machine. You can place it anywhere on the Oracle Application Server machine. In the Developer Prompt, you can just navigate to that directory.

  3. Run ant.

    > ant
    
    

7.8.2 Viewing SelectManufacturer in the Oracle BPEL Control

After deployment, SelectManufacturer appears in the Oracle BPEL Control. Enter the following URL in a browser to bring up the Oracle BPEL Control:

http://hostname:port/BPELConsole

Log in as the oc4jadmin user.

SelectManufacturer appears in the Dashboard tab of the Oracle BPEL Control:

Figure 7-23 Oracle BPEL Control Showing SelectManufacturer

Description of Figure 7-23 follows
Description of "Figure 7-23 Oracle BPEL Control Showing SelectManufacturer"