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

8 Creating the SOAOrderBooking Project

This chapter describes how to create the SOAOrderBooking project, which is a BPEL project. It contains these sections:

8.1 About the SOAOrderBooking Project

The SOAOrderBooking project, which is a BPEL project, represents the main flow in the SOA Order Booking application. It sends the order information to the appropriate services at the appropriate times. For example, it contacts CreditService to check the customer's credit card, and if the credit card is acceptable, it contacts the suppliers (Select Manufacturer and Rapid Distributors) to get price quotes for the order.

The SOAOrderBooking project is a large project. This chapter begins by giving an overview of the major blocks in the project, then it goes into detail for each block.

8.1.1 Blocks in the SOAOrderBooking Project

Table 8-1 lists the major blocks in the SOAOrderBooking project:

Table 8-1 Major Blocks in the SOAOrderBooking Project

Block Type Description

receiveInput

Receive activity

This activity receives incoming requests, which include the order information.

InsertOrderIntoDB

Scope

This scope inserts the order information into the database.

CustomerService

Scope

This scope retrieves the customer's information from the database.

CreditService

Scope

This scope verifies that the customer has acceptable credit.

RequiresManualApproval

Decision

This scope is a decide activity: it consults the rules set up in a rules repository to determine whether or not an order needs to be approved by a manager. The manager can approve or reject the order.

requiresApproval

Switch

This switch checks whether the manager approved or rejected the order, and performs the appropriate activities.

For approved orders, it just continues with the rest of the activities in this SOAOrderBooking project.

For rejected orders, it throws a fault and does not continue.

SelectSupplier

Scope

This scope selects which supplier (Select Manufacturer or Rapid Distributors) gets to fulfill the order.

PostFulfillmentReq

Scope

This scope calls the FulfillmentESB project, which determines the shipping method for the order.

SetFinalOrderStatus

Scope

This scope writes the final order status in the database.

NotifyCustomer

Scope

This scope is an email service. It sends out email to the customers informing them that their orders have been processed successfully.

callbackClient

Invoke activity

This invoke activity notifies the client that it is done.


8.1.2 Blocks Shown in Minimized View

Figure 8-1 shows the SOAOrderBooking.bpel page in JDeveloper with the blocks minimized. Later sections in this chapter expand the blocks to show their contents and describe how to create the blocks.

Figure 8-1 Minimized View of the Blocks in SOAOrderBooking Project

Description of Figure 8-1 follows
Description of "Figure 8-1 Minimized View of the Blocks in SOAOrderBooking Project"

8.2 Create a New BPEL Project for SOAOrderBooking

  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 8-2 New Gallery for SOAOrderBooking Project

    Description of Figure 8-2 follows
    Description of "Figure 8-2 New Gallery for SOAOrderBooking Project"

    Click OK. This displays the BPEL Project Creation wizard.

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

    • Name: enter SOAOrderBooking.

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

    • Use Default Project Settings: select this option.

    • Template: select Empty BPEL Process.

    Figure 8-3 BPEL Project Creation Wizard: Project Settings Page

    Description of Figure 8-3 follows
    Description of "Figure 8-3 BPEL Project Creation Wizard: Project Settings Page"

    Click Finish.

8.3 Copy Files

Copy the following files from the soademo_101310_prod.zip file to the SOAOrderBooking\bpel directory:

In the soademo_101310_prod.zip file, these files are located in the SOAOrderBooking\bpel directory.

8.4 Define Variables for the SOAOrderBooking Project

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

  1. Double-click the SOAOrderBooking scope. You can double-click the "SOAOrderBooking" text that is displayed sideways.

    This displays the Process dialog.

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

    Figure 8-4 Process Dialog for SOAOrderBooking

    Description of Figure 8-4 follows
    Description of "Figure 8-4 Process Dialog for SOAOrderBooking"

  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 > Project WSDL Files > SOAOrderBooking.wsdl > Message Types > SOAOrderBookingRequestMessage.

        Figure 8-5 Type Chooser for inputVariable

        Description of Figure 8-5 follows
        Description of "Figure 8-5 Type Chooser for inputVariable"

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

      Figure 8-6 Create Variable Dialog for inputVariable

      Description of Figure 8-6 follows
      Description of "Figure 8-6 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 in the Process dialog 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 > Project WSDL Files > SOAOrderBooking.wsdl > Message Types > SOAOrderBookingResponseMessage.

        Figure 8-7 Type Chooser for outputVariable

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

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

      Figure 8-8 Create Variable Dialog for outputVariable

      Description of Figure 8-8 follows
      Description of "Figure 8-8 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 8-9 Process Dialog Showing inputVariable and outputVariable

    Description of Figure 8-9 follows
    Description of "Figure 8-9 Process Dialog Showing inputVariable and outputVariable"

  6. Click OK in the Process dialog.

  7. Select File > Save to save your work.

8.5 Create "client" Partner Link

This client partner link represents the client, which passes data to the receiveInput activity and gets invoked at the end of the flow to receive the return value.

  1. If the Component Palette is not showing, select View > Component Palette. Select Services from the dropdown in the Component Palette.

  2. Drag the Partner Link icon from the Component Palette and drop it into a Services swimlane. This displays the Create Partner Link dialog.

  3. In the Create Partner Link dialog, set these values:

    • Name: enter client.

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

      Figure 8-10 Service Explorer for client Partner Link

      Description of Figure 8-10 follows
      Description of "Figure 8-10 Service Explorer for client Partner Link"

      Click OK in the Service Explorer.

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

    • Partner Role: select SOAOrderBookingRequester.

    • My Role: select SOAOrderBookingProvider.

    • Process: leave it blank.

    Before clicking OK, check that Name is still set to client. JDeveloper may have changed it to SOAOrderBooking when it was filling in the other fields for you.

    Figure 8-11 Create Partner Link Dialog for client

    Description of Figure 8-11 follows
    Description of "Figure 8-11 Create Partner Link Dialog for client"

  4. Click OK in the Create Partner Link dialog.

  5. Select File > Save to save your work.

8.6 Receive Input from the Client (Receive Activity)

Create a receive activity to receive the input data from the client. In the receive activity, you also define a sensor to send data to a JMS topic.

8.6.1 Create the Receive Activity

Create the receive activity:

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

  2. Drag the Receive icon from the Component Palette and drop it on the page where it says "Drop Activity Here".

    The page should look like this at this point:

    Figure 8-12 SOAOrderBooking Page with Receive Activity

    Description of Figure 8-12 follows
    Description of "Figure 8-12 SOAOrderBooking Page with Receive Activity"

  3. Do one of the following to display the Receive dialog:

    • Drag one of the arrows on the side of the Receive_1 activity and drop it on the "client" partner link. This associates the receive activity with the partner link.

    • Double-click the new Receive_1 activity.

  4. In the Receive dialog, enter these values:

    • Name: enter receiveInput.

    • Partner Link: should be set to client. This is filled in for you if you dragged the arrow from the Receive_1 activity and dropped it on the "client" partner link. If not, click the flashlight to display the Partner Link Chooser dialog and select client.

      Figure 8-13 Partner Link Chooser Dialog for "receiveInput" Receive Activity

      Description of Figure 8-13 follows
      Description of "Figure 8-13 Partner Link Chooser Dialog for "receiveInput" Receive Activity"

      Click OK in the Partner Link Chooser dialog.

    • Operation: select initiate. This should be filled in automatically for you.

    • Variable: click the Browse Variables icon (the icon on the right). In the Variable Chooser dialog, select inputVariable.

      Figure 8-14 Variable Chooser Dialog for "receiveInput" Receive Activity

      Description of Figure 8-14 follows
      Description of "Figure 8-14 Variable Chooser Dialog for "receiveInput" Receive Activity"

      Click OK in the Variable Chooser.

    • Create Instance: select this option.

    The Receive dialog now looks like this:

    Figure 8-15 Receive Dialog for "receiveInput" Receive Activity

    Description of Figure 8-15 follows
    Description of "Figure 8-15 Receive Dialog for "receiveInput" Receive Activity"

  5. Click OK in the Receive dialog.

  6. Select File > Save to save your work.

8.6.2 Create a Sensor for the Receive Activity

In this receive activity create an activity sensor for the receive activity. After this activity runs, this sensor writes the order information to a JMS topic. There is no consumer for this JMS topic; the purpose of this sensor is to show how to send order information to another destination.

  1. Double-click the "receiveInput" activity to display the Receive dialog.

  2. Click the Sensors tab in the Receive dialog.

  3. Click Create to create a new sensor. This displays the Create Activity Sensor dialog.

  4. In the Create Activity Sensor dialog, set the Name to InstanceStart.

  5. Set the Evaluation Time to Completion. This specifies when the sensor fires. Completion signifies that the sensor fires after this activity has run.

  6. In the Activity Variable Sensors section, click Create to display the Create Activity Variable Sensor dialog.

    Figure 8-16 Create Activity Variable Sensor Dialog

    Description of Figure 8-16 follows
    Description of "Figure 8-16 Create Activity Variable Sensor Dialog"

  7. In the Create Activity Variable Sensor dialog, click the pencil icon for Variable XPath. This displays the Variable XPath Builder dialog.

    Figure 8-17 Variable XPath Builder Dialog

    Description of Figure 8-17 follows
    Description of "Figure 8-17 Variable XPath Builder Dialog"

  8. Select Variables > Process > Variables > inputVariable.

  9. Click OK in the Variable XPath Builder. The Create Activity Variable Sensor dialog should be filled in with these values for you (see Figure 8-16):

    Variable XPath: $inputVariable

    Output Namespace: http://www.globalcompany.com/ns/OrderBooking

    Output Datatype: SOAOrderBookingRequestMessage

  10. Click OK in the Create Activity Variable Sensor dialog. This takes you back to the Create Activity Sensor dialog (Figure 8-21).

  11. In the Create Activity Sensor dialog, click the Add icon in the Sensor Actions section. This displays the Sensor Action Chooser dialog.

    Figure 8-18 Sensor Action Chooser Dialog

    Description of Figure 8-18 follows
    Description of "Figure 8-18 Sensor Action Chooser Dialog"

  12. In the Sensor Action Chooser dialog, select Sensor Actions and select Sensor Action from the wand icon. This displays the Create Sensor Action dialog.

  13. In the Create Sensor Action dialog:

    • Name: enter InstanceStart.

    • Publish Type: select JMS Topic.

    • JMS Connection Factory: enter jms/TopicConnectionFactory.

    • Publish Target: enter jms/demoTopic.

    • Filter: leave blank.

    • Enable: select this option.

    Figure 8-19 Create Sensor Action Dialog

    Description of Figure 8-19 follows
    Description of "Figure 8-19 Create Sensor Action Dialog"

  14. Click OK in the Create Sensor Action dialog. The Sensor Action Chooser dialog now shows the InstanceStart sensor action.

    Figure 8-20 Sensor Action Chooser Dialog

    Description of Figure 8-20 follows
    Description of "Figure 8-20 Sensor Action Chooser Dialog"

  15. Click OK in the Sensor Action Chooser. This takes you back to the Create Activity Sensor dialog, which now looks like this:

    Figure 8-21 Create Activity Sensor Dialog

    Description of Figure 8-21 follows
    Description of "Figure 8-21 Create Activity Sensor Dialog"

  16. Click OK in the Create Activity Sensor dialog.

    In the Receive dialog, the Sensors tab now looks like this:

    Figure 8-22 Receive Dialog, Sensors Tab

    Description of Figure 8-22 follows
    Description of "Figure 8-22 Receive Dialog, Sensors Tab"

  17. Click OK in the Receive dialog.

  18. Select File > Save to save your work.

The SOAOrderBooking page now looks like this:

Figure 8-23 SOAOrderBooking.bpel Page with Receive Activity

Description of Figure 8-23 follows
Description of "Figure 8-23 SOAOrderBooking.bpel Page with Receive Activity"

The sensor information is stored in these files in the SOAOrderBooking\bpel directory:

  • sensor.xml

  • sensorAction.xml

8.7 Insert Order Information in the Database ("InsertOrderIntoDB" Scope)

In this scope, you create activities to insert the order information into the database. Figure 8-24 shows the activities that you will create for the "InsertOrderIntoDB" scope.

Figure 8-24 Activities in the "InsertOrderIntoDB" Scope

Description of Figure 8-24 follows
Description of "Figure 8-24 Activities in the "InsertOrderIntoDB" Scope"

8.7.1 Create a Database Adapter for Writing to the ORDERS Table

Activities in the "InsertOrderIntoDB" scope use a database adapter for writing order information to the ORDERS table in the database. During runtime, the database adapter connects to the database through the eis/DB/soademo connection that you set up in Section 2.6.4, "Create a Database Adapter Connection Factory".

To create the database adapter:

  1. In the Component Palette, select Services from the dropdown.

  2. Drag the Database Adapter icon from the Component Palette and drop it in a Services swimlane. This launches the Adapter Configuration wizard. Click Next on the welcome page to continue.

  3. In Step 1, Service Name, enter Order as the Service Name, and click Next.

    Figure 8-25 Adapter Configuration Wizard, Step 1, Service Name

    Description of Figure 8-25 follows
    Description of "Figure 8-25 Adapter Configuration Wizard, Step 1, Service Name"

  4. In Step 2, Service Connection:

    Figure 8-26 Adapter Configuration Wizard, Step 2, Service Connection

    Description of Figure 8-26 follows
    Description of "Figure 8-26 Adapter Configuration Wizard, Step 2, Service Connection"

    Click Next.

  5. In Step 3, Operation Type, select Perform an Operation on a Table, and select Insert or Update (Merge). The SOA Order Booking application only needs to insert rows in the table.

    Figure 8-27 Adapter Configuration Wizard, Step 3, Operation Type

    Description of Figure 8-27 follows
    Description of "Figure 8-27 Adapter Configuration Wizard, Step 3, Operation Type"

    Click Next.

  6. In Step 4, Select Table, click Import Tables.

    In the Import Tables dialog, click Query.

    Select ORDERS and ITEMS and click the right-arrow button to move them to the Selected box. The database adapter will write to these tables.

    Figure 8-28 Import Tables Dialog for FedexShipment

    Description of Figure 8-28 follows
    Description of "Figure 8-28 Import Tables Dialog for FedexShipment"

    Click OK in the Import Tables dialog. Step 4, Select Table, now looks like this:

    Figure 8-29 Adapter Configuration Wizard, Step 4, Select Table

    Description of Figure 8-29 follows
    Description of "Figure 8-29 Adapter Configuration Wizard, Step 4, Select Table"

  7. Select SOADEMO.ORDERS and click Next.

  8. In Step 5, Relationships, click Next.

    Figure 8-30 Adapter Configuration Wizard, Step 5, Relationships

    Description of Figure 8-30 follows
    Description of "Figure 8-30 Adapter Configuration Wizard, Step 5, Relationships"

  9. On the Finish page, click Finish.

  10. JDeveloper displays the Create Partner Link dialog with the fields filled in:

    Figure 8-31 Create Partner Link Dialog for Order Database Adapter

    Description of Figure 8-31 follows
    Description of "Figure 8-31 Create Partner Link Dialog for Order Database Adapter"

    Click OK in the Create Partner Link dialog. You should see the "Orders" database adapter in the Services swimlane.

  11. Select File > Save to save your work.

The wizard creates the following files in the SOAOrderBooking directory:

  • bpel\DBAdapterOutboundHeader.wsdl -- this file contains generic information for connecting to a database.

  • bpel\Order.wsdl -- this file contains the information that you specified in the wizard.

  • bpel\Order_table.xsd -- this file contains the schema information for the ORDERS and ITEMS tables.

  • bpel\Order_toplink_mappings.xml -- this file is used by TopLink

  • src\Order\Orders.java

  • src\Order\Items.java

  • database\SOADEMO\ORDERS.table

  • database\SOADEMO\ITEMS.table

  • toplink\Order\Order.mwp

8.7.2 Create a Database Adapter for Retrieving the Order ID from the Database

Before you can insert order information in the ORDERS table in the database, you need to retrieve the order ID from the database. The order ID is generated from a database sequence.

  1. In the Component Palette, select Services from the dropdown.

  2. Drag the Database Adapter icon from the Component Palette and drop it in a Services swimlane. This launches the Adapter Configuration Wizard. Click Next on the welcome page to continue.

  3. In Step 1, Service Name, enter OrderSequence as the Service Name, and click Next.

    Figure 8-32 Adapter Configuration Wizard, Step 1, Service Name

    Description of Figure 8-32 follows
    Description of "Figure 8-32 Adapter Configuration Wizard, Step 1, Service Name"

  4. In Step 2, Service Connection:

    Figure 8-33 Adapter Configuration Wizard, Step 2, Service Connection

    Description of Figure 8-33 follows
    Description of "Figure 8-33 Adapter Configuration Wizard, Step 2, Service Connection"

    Click Next.

  5. In Step 3, Operation Type, select Execute Custom SQL.

    Figure 8-34 Adapter Configuration Wizard, Step 3, Operation Type

    Description of Figure 8-34 follows
    Description of "Figure 8-34 Adapter Configuration Wizard, Step 3, Operation Type"

    Click Next.

  6. In Step 4, Custom SQL, enter the following SQL statement in the SQL box:

    select order_seq_id_gen.nextval from dual

    The wizard displays the appropriate statements in the XSD box.

    Figure 8-35 Adapter Configuration Wizard, Step 4, Custom SQL

    Description of Figure 8-35 follows
    Description of "Figure 8-35 Adapter Configuration Wizard, Step 4, Custom SQL"

    Click Next.

  7. On the Finish page, click Finish.

  8. JDeveloper displays the Create Partner Link dialog with the fields filled in:

    Figure 8-36 Create Partner Link Dialog for OrderSequence Database Adapter

    Description of Figure 8-36 follows
    Description of "Figure 8-36 Create Partner Link Dialog for OrderSequence Database Adapter"

    Click OK in the Create Partner Link dialog. You should see the OrderSequence database adapter in the Services swimlane.

  9. Select File > Save to save your work.

The wizard creates the following files in the SOAOrderBooking directory:

  • bpel\OrderSequence.wsdl -- this file contains the information that you specified in the wizard.

  • bpel\OrderSequence.xsd -- this file defines the format of the sequence input and output.

8.7.3 Create the "InsertOrderIntoDB" Scope

Create a new scope called "InsertOrderIntoDB" to contain the activities for writing order information in the database.

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag the Scope icon from the Component Palette and drop it between the "receiveInput" activity and the "callbackClient" activity".

  3. Double-click the new scope to display the Scope dialog.

  4. In the Scope dialog, in the General tab:

    • Name: enter InsertOrderIntoDB.

    • Variable Access Serializable: do not select.

  5. Click the Variables tab. You need to create three variables for this scope: orderRequest, orderSequenceInput, orderSequenceOutput.

  6. Create the orderRequest variable:

    1. In the Variables tab, click Create.

    2. In the Create Variable dialog:

    3. Click OK in the Create Variable dialog. This returns you to the Scope dialog.

  7. Create the orderSequenceInput variable:

    1. In the Variables tab, click Create.

    2. In the Create Variable dialog:

    3. Click OK in the Create Variable dialog. This returns you to the Scope dialog.

  8. Create the orderSequenceOutput variable:

    1. In the Variables tab, click Create.

    2. In the Create Variable dialog:

    3. Click OK in the Create Variable dialog. This returns you to the Scope dialog. You should see all three variables in the dialog.

      Figure 8-43 Scope Dialog for InsertOrderIntoDB, Variables Tab

      Description of Figure 8-43 follows
      Description of "Figure 8-43 Scope Dialog for InsertOrderIntoDB, Variables Tab"

  9. Click OK in the Scope dialog.

  10. Select File > Save to save your work.

8.7.4 Retrieve the Order ID from the Database Sequence ("GetOrderId" Invoke Activity)

This invoke activity retrieves the next value from the order_seq_id_gen database sequence and stores it in the orderSequenceOutput variable.

  1. Expand the "InsertOrderIntoDB" scope.

  2. Drag the Invoke icon from the Component Palette and drop it in the "InsertOrderIntoDB" scope.

  3. Do one of the following to display the Invoke dialog:

    • Drag one of the arrows on the side of the "Invoke_1" activity and drop it on the "OrderSequence" database adapter. This associates the invoke activity with the database adapter.

    • Double-click the new Invoke_1 activity.

  4. In the Invoke dialog, set these values:

    The Invoke dialog should look like this:

    Figure 8-47 Invoke Dialog for "GetOrderId" Invoke Activity

    Description of Figure 8-47 follows
    Description of "Figure 8-47 Invoke Dialog for "GetOrderId" Invoke Activity"

  5. Click OK in the Invoke dialog.

  6. Select File > Save to save your work.

The SOAOrderBooking.bpel page should now look like this:

Figure 8-48 SOAOrderBooking.bpel Page

Description of Figure 8-48 follows
Description of "Figure 8-48 SOAOrderBooking.bpel Page"

8.7.5 Prepare the Order ID and Order Status Information ("AssignOrderStatus" Assign Activity)

This assign activity prepares two values for insertion into the database:

  • It invokes the order_seq_id_gen database sequence to get the order ID.

  • It sets the order status to "pending".

These values are used by the "InsertOrder" invoke activity when it writes the order information to the database.

To create this assign activity:

  1. Drag the Assign activity icon from the Component Palette and drop it below the "GetOrderId" activity in the "InsertOrderIntoDB" scope.

  2. Double-click the new assign activity to display the Assign dialog.

  3. In the Assign dialog, click the General tab, and set the Name to AssignOrderStatus.

  4. Still in the Assign dialog, click the Copy Operation tab and create two copy operations: one to copy the order ID and another one to copy the order status.

  5. Create the copy operation to copy the order ID:

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

    2. In the From side, set Type to Variable, and select Variables > Process > Scope - InsertOrderIntoDB > Variables > orderSequenceOutput > OrderSequenceOutputCollection > ns4:OrderSequenceOutputCollection > ns4:OrderSequenceOutput > ns4:order_seq_id_gen.nextval.

    3. In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:ID.

      Figure 8-49 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Copy the Order ID

      Description of Figure 8-49 follows
      Description of "Figure 8-49 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Copy the Order ID"

    4. Click OK in the Create Copy Operation dialog.

  6. Create the copy operation to copy the order status:

    1. Select Copy Operation from the Create dropdown again to create the second copy operation. This displays the Create Copy Operation dialog.

    2. In the From side, set Type to Expression, and enter the following line in the Expression box:

      string('pending')
      
      
    3. In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderStatus.

      Figure 8-50 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Copy the Order Status

      Description of Figure 8-50 follows
      Description of "Figure 8-50 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Copy the Order Status"

    4. Click OK in the Create Copy Operation dialog.

  7. You should see two copy operations in the Assign dialog. Click OK.

    Figure 8-51 Assign Dialog for "AssignOrderStatus" Activity

    Description of Figure 8-51 follows
    Description of "Figure 8-51 Assign Dialog for "AssignOrderStatus" Activity"

  8. Select File > Save to save your work.

The SOAOrderBooking.bpel page should now look like this:

Figure 8-52 SOAOrderBooking.bpel Page

Description of Figure 8-52 follows
Description of "Figure 8-52 SOAOrderBooking.bpel Page"

8.7.6 Create the Mapping File ("TransformOrder" BPEL Service)

In this transform service, you create a file called TransformOrder.xsl to map the incoming order information to the schema defined in Order_table.xsd, which prepares it for insertion in the database. Order_table.xsd was created by the Adapter Configuration wizard that you ran in Section 8.7.1, "Create a Database Adapter for Writing to the ORDERS Table".

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag the Transform icon from the Component Palette and drop it after the "AssignOrderStatus" activity.

  3. Double-click the new transform activity to display the Transform dialog.

  4. In the Transform dialog, click the General tab and set the Name to TransformOrder.

  5. Click the Transformation tab in the dialog and set these values:

    • Source Variable: select inputVariable. The Source Part should be set to payload.

    • Target Variable: select orderRequest. The Target Part should be set to OrdersCollection.

    • Mapper File: enter TransformOrder.xsl and click the Create Mapping icon (the middle icon). This displays the Data Mapping tool for TransformOrder.xsl.

      In the Data Mapping tool, create the simple mappings shown in Table 8-2. The left column shows the source side and the right column shows the target side. You create the simple mappings by dragging and dropping the labels from the source side to the target side.

      Table 8-2 Simple Mappings

      Source > client:SOAOrderBookingProcessRequest > po:PurchaseOrder Target > OrdersCollection > Orders

      po:CustID

      custid

      po:ID

      ordid

      po:OrderInfo > po:OrderDate

      orderdate

      po:OrderInfo > po:OrderPrice

      price

      po:OrderInfo > po:OrderStatus

      status


      Figure 8-53 shows the Data Mapper with the simple mappings done.

      Figure 8-53 Data Mapper for Transform Activity in InsertOrderIntoDB Scope

      Description of Figure 8-53 follows
      Description of "Figure 8-53 Data Mapper for Transform Activity in InsertOrderIntoDB Scope"

      Process all the items in the order by creating a "for-each" element in the XSL file:

      a. Select XSLT Constructs from the dropdown in the Component Palette in the Data Mapper.

      b. On the target side, expand itemsCollection and Items.

      c. Drag the for-each item from the Component Palette and drop it on Items. You want the for-each label to show up between itemsCollection and Items on the target side.

      d. Expand po:OrderItems on the source side to that you can see po:Item below it. Expand po:Item as well.

      e. Drag a line from po:Item on the source side to the for-each item on the target side.

      f. Map the following item fields:

      Table 8-3 Mappings for the "for-each" Items

      Source > client:SOAOrderBookingProcessRequest > po:PurchaseOrder > po:OrderItems > po:Item Target > OrdersCollection > Orders > itemsCollection > for-each > Items

      po:ProductName

      productname

      po:partnum

      partnum

      po:price

      price

      po:Quantity

      quantity


      For itemid on the target side, you want to map it to the position() function. To do this in the Data Mapper:

      a. Select Node-set Functions from the dropdown in the Component Palette.

      b. Drag the position item from the Component Palette and drop it in the middle area (between the source and target areas).

      c. Drag a line from itemid on the target side to the position item in the middle area.

      d. Select File > Save to save TransformOrder.xsl.

      Figure 8-54 shows the complete transformation in the Data Mapper.

      Figure 8-54 Data Mapper Showing Complete Mappings for the Transformation Activity

      Description of Figure 8-54 follows
      Description of "Figure 8-54 Data Mapper Showing Complete Mappings for the Transformation Activity"

      e. Select File > Close to close TransformOrder.xsl. This takes you back to the main editor in JDeveloper.

  6. Select File > Save in the main editor to save SOAOrderBooking.bpel.

8.7.7 Insert the Order Information into the Database ("InsertOrder" Invoke Activity)

This invoke activity inserts the data into the database.

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag the Invoke icon from the Component Palette and drop it below the "TransformOrder" activity.

  3. Do one of the following to display the Invoke dialog:

    • Drag one of the arrows on the side of the Invoke_1 activity and drop it on the "Order" database adapter. This associates the Invoke_1 activity with the database adapter.

    • Double-click the new Invoke_1 activity.

  4. In the Invoke dialog, set these values:

    The Invoke dialog should look like this:

    Figure 8-57 Invoke Dialog for "InsertOrder" Invoke Activity

    Description of Figure 8-57 follows
    Description of "Figure 8-57 Invoke Dialog for "InsertOrder" Invoke Activity"

  5. Click OK in the Invoke dialog.

  6. Select File > Save to save your work.

The SOAOrderBooking.bpel project should now look like this:

Figure 8-58 SOAOrderBooking.bpel Page

Description of Figure 8-58 follows
Description of "Figure 8-58 SOAOrderBooking.bpel Page"

8.7.8 Minimize the "InsertOrderIntoDB" Scope

Click the [-] icon for the "InsertOrderIntoDB" scope to minimize it. When it is minimized, it makes it easier to create a new scope that is at the same level as the scope you minimized. Otherwise, you can accidentally drag and drop a new scope inside the existing scope. To see what a minimized scope looks like, see Figure 8-1.

 

8.8 Retrieve Information About the Customer ("CustomerService" Scope)

This scope invokes the CustomerService service to retrieve information about the customer. It uses the assign activity to populate variables with the returned information.

Figure 8-59 shows the activities in the "CustomerService" scope.

Figure 8-59 Activities in the "CustomerService" Scope

Description of Figure 8-59 follows
Description of "Figure 8-59 Activities in the "CustomerService" Scope"

8.8.1 Create the "CustomerService" Partner Link

The "CustomerService" partner link provides the SOAOrderBooking project with a way to communicate with the CustomerService service deployed on Oracle Application Server. The CustomerSvc.wsdl file includes a URL that returns the WSDL for CustomerService.

  1. Copy the following file from the soademo_101310_prod.zip file to the SOAOrderBooking\bpel directory.

    • CustomerSvc.wsdl

    In the soademo_101310_prod.zip file, the CustomerSvc.wsdl file is located in the SOAOrderBooking\bpel directory.

  2. Verify the URL in the CustomerSvc.wsdl file.

    1. In JDeveloper, select File > Open and open the CustomerSvc.wsdl file.

    2. Click the Source tab at the bottom of the editor to view the lines in the file.

    3. The http://localhost:8888 reference in the file assumes that Oracle Application Server is running on the same machine as JDeveloper, and that Oracle Application Server is listening for requests on port 8888.

      If necessary, change localhost to the name of the machine running Oracle Application Server, and 8888 to the correct port used by your Oracle Application Server installation, for example: mypc.mydomain.com:8889.

    4. If you edited the file, save the file and close it.

  3. In the Component Palette, select Services from the dropdown.

  4. Drag the Partner Link icon from the Component Palette and drop it in a Services swimlane.

  5. In the Create Partner Link dialog:

    • Name: enter CustomerService.

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

      Figure 8-60 Service Explorer for "CustomerService" Partner Link

      Description of Figure 8-60 follows
      Description of "Figure 8-60 Service Explorer for "CustomerService" Partner Link"

      Click OK in the Service Explorer.

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

    • Partner Role: select CustomerService_Role.

    • My Role: leave it blank.

    The Create Partner Link dialog should look like this:

    Figure 8-61 Create Partner Link Dialog for "CustomerService" Partner Link

    Description of Figure 8-61 follows
    Description of "Figure 8-61 Create Partner Link Dialog for "CustomerService" Partner Link"

    Before clicking OK, check that the Name is CustomerService. JDeveloper may have changed it CustomerSvc. Click OK in the Create Partner Link dialog.

8.8.2 Create the "CustomerService" Scope

Create a new scope called "CustomerService".

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag the Scope icon from the Component Palette and drop it below the "InsertOrderIntoDB" scope.

  3. Double-click the new scope to display the Scope dialog.

  4. In the Scope dialog, in the General tab:

    • Name: enter CustomerService.

    • Variable Access Serializable: do not select.

  5. Click the Variables tab. You need to create a variable for this scope.

  6. In the Variables tab, click Create.

  7. In the Create Variable dialog:

    • Name: enter customerServiceRequest.

    • Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > CustomerService > CustomerSvc.wsdl > Imported WSDL > CustomerService > Message Types > CustomerService_findCustomerById.

      Figure 8-62 Type Chooser Dialog for "customerServiceRequest" Variable

      Description of Figure 8-62 follows
      Description of "Figure 8-62 Type Chooser Dialog for "customerServiceRequest" Variable"

      Click OK in the Type Chooser.

  8. In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/customer}CustomerService_findCustomerById.

    Figure 8-63 Create Variable Dialog for "customerServiceRequest" Variable

    Description of Figure 8-63 follows
    Description of "Figure 8-63 Create Variable Dialog for "customerServiceRequest" Variable"

  9. Click OK in the Create Variable dialog.

  10. The customerServiceRequest variable appears in the Variables tab of the Scope dialog.

    Figure 8-64 Scope Dialog Showing Variables Tab for CustomerService Scope

    Description of Figure 8-64 follows
    Description of "Figure 8-64 Scope Dialog Showing Variables Tab for CustomerService Scope"

    Click OK in the Scope dialog.

8.8.3 Assign Customer ID to the findCustomerById Operation ("AssignRequest" Assign Activity)

This assign activity assigns the customer ID information to the customerServiceRequest variable. This variable is then used as the input variable in the "GetCustInfo" invoke activity.

  1. Expand the CustomerService scope.

  2. Drag the Assign activity icon from the Component Palette and drop it in the CustomerService scope.

  3. Double-click the new assign activity to display the Assign dialog.

  4. In the Assign dialog, click the General tab, and set the Name to AssignRequest.

  5. Still in the Assign dialog, click the Copy Operation tab.

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

    • In the From side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:CustID.

    • In the To side, set Type to Variable, and select Variables > Process > Scope - Customer Service > Variables > customerServiceRequest > parameters > ns8:findCustomerById > ns8:custid.

    Figure 8-65 Create Copy Operation Dialog for "AssignRequest" Activity

    Description of Figure 8-65 follows
    Description of "Figure 8-65 Create Copy Operation Dialog for "AssignRequest" Activity"

    Click OK in the Create Copy Operation dialog.

  7. You should see the copy operation in the Assign dialog. Click OK.

    Figure 8-66 Assign Dialog for "AssignRequest" Activity

    Description of Figure 8-66 follows
    Description of "Figure 8-66 Assign Dialog for "AssignRequest" Activity"

8.8.4 Create a Variable to Contain the Results of findCustomerById ("customerServiceResponse" Process Variable)

The customerServiceResponse variable is used to contain the results of the findCustomerById operation.

Create the customerServiceResponse variable in the SOAOrderBooking scope. The variable is created at this level so that any activity in this BPEL process can access it.

  1. Double-click the SOAOrderBooking scope. You can double-click the "SOAOrderBooking" text that is sideways. This displays the Process dialog.

  2. In the Process dialog, click Create in the Variables tab. This displays the Create Variable dialog.

  3. In the Create Variable dialog:

    • Name: enter customerServiceResponse.

    • 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 > CustomerService > CustomerSvc.wsdl > Imported WSDL > Customer Service > Message Types > CustomerService_findCustomerByIdResponse.

      Figure 8-67 Type Chooser Dialog for "customerServiceResponse" Process Variable

      Description of Figure 8-67 follows
      Description of "Figure 8-67 Type Chooser Dialog for "customerServiceResponse" Process Variable"

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

    Figure 8-68 Create Variable Dialog for "customerServiceResponse" Process Variable

    Description of Figure 8-68 follows
    Description of "Figure 8-68 Create Variable Dialog for "customerServiceResponse" Process Variable"

  4. Click OK in the Create Variable dialog. The customerServiceResponse variable appears in the Process dialog.

    Figure 8-69 Process Dialog Showing customerServiceResponse Variable

    Description of Figure 8-69 follows
    Description of "Figure 8-69 Process Dialog Showing customerServiceResponse Variable"

  5. Click OK in the Process dialog.

  6. Select File > Save to save your work.

8.8.5 Invoke findCustomerById ("GetCustInfo" Invoke Activity)

This invoke activity accesses the CustomerService partner link and invokes the findCustomerById operation. The operation is invoked with the customer ID assigned in the "AssignRequest" activity. The results of the operation is stored in the customerServiceResponse variable.

  1. Drag the Invoke icon from the Component Palette and drop it below the "AssignRequest" activity.

  2. Do one of the following to display the Invoke dialog:

    • Drag one of the arrows on the side of the Invoke_1 activity and drop it on the "CustomerService" partner link. This associates the invoke activity with the partner link.

    • Double-click the new Invoke_1 activity.

  3. In the Invoke dialog, set these values:

    The Invoke dialog should look like this:

    Figure 8-73 Invoke Dialog for the "GetCustInfo" Invoke Activity

    Description of Figure 8-73 follows
    Description of "Figure 8-73 Invoke Dialog for the "GetCustInfo" Invoke Activity"

  4. Click OK in the Invoke dialog.

  5. Select File > Save to save your work.

8.8.6 Create the "AssignInitialCustomerResponse" Assign Activity

This assign activity appends the customer's first name and last name to the payload part of the inputVariable. It uses an XML fragment to perform this append operation.

  1. Drag the Assign activity icon from the Component Palette and drop it below the "GetCustInfo" activity.

  2. Double-click the new assign activity to display the Assign dialog.

  3. In the Assign dialog, click the General tab, and set the Name to AssignInitialCustomerResponse.

  4. Still in the Assign dialog, click the Copy Operation tab. You will create an append operation.

  5. Select Append Operation from the Create dropdown. This displays the Create Append Operation dialog.

    • In the From side, select XML Fragment from the Type dropdown, and enter the following in the XML Fragment box:

      <nsx:ShipTo xmlns:nsx="http://www.globalcompany.com/ns/order">
         <nsx:Name>
            <nsx:First/>
            <nsx:Last/>
         </nsx:Name>
      </nsx:ShipTo>
      
      

      Note that you need to replace the nsx prefix with the prefix for "http://www.globalcompany.com/ns/order". To determine the prefix, scroll to the beginning of your SOAOrderBooking.bpel file and look for this line:

      xmlns:prefix="http://www.globalcompany.com/ns/order"

      For example, if the line in your file looks like the following:

      xmlns:ns1="http://www.globalcompany.com/ns/order"
      
      

      then you need to change the prefix to ns1 in the XML fragment.

    • In the To side, select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder.

    Figure 8-74 Create Append Operation Dialog for the "AssignInitialCustomerResponse" Activity

    Description of Figure 8-74 follows
    Description of "Figure 8-74 Create Append Operation Dialog for the "AssignInitialCustomerResponse" Activity"

    Click OK in the Create Append Operation dialog.

  6. You should see the append operation in the Assign dialog.

    Figure 8-75 Assign Dialog for the "AssignInitialCustomerResponse" Activity

    Description of Figure 8-75 follows
    Description of "Figure 8-75 Assign Dialog for the "AssignInitialCustomerResponse" Activity"

    Click OK in the Assign dialog.

  7. Select File > Save to save your work.

8.8.7 Copy the Customer's First and Last Names to the inputVariable ("AssignCustomerResponse" Assign Activity)

This assign activity assigns the first and last names of the customer (which were retrieved from the database) to the inputVariable.

  1. Drag the Assign activity icon from the Component Palette and drop it below the "AssignInitialCustomerResponse" activity.

  2. Double-click the new assign activity to display the Assign dialog.

  3. In the Assign dialog, click the General tab, and set the Name to AssignCustomerResponse.

  4. Still in the Assign dialog, click the Copy Operation tab. You will create two copy operations.

  5. Create the first copy operation: Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.

    • In the From side, set Type to Variable, and select Variables > Process > Variables > customerServiceResponse > parameters > ns8:findCustomerByIdResponse > ns8:return > ns8:fname.

    • In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:ShipTo > ns1:Name > ns1:First.

    Figure 8-76 Create Copy Operation Dialog for "AssignCustomerResponse" Activity, First Copy Operation

    Description of Figure 8-76 follows
    Description of "Figure 8-76 Create Copy Operation Dialog for "AssignCustomerResponse" Activity, First Copy Operation"

    Click OK in the Create Copy Operation dialog.

  6. Create the second copy operation: Select Copy Operation from the Create dropdown again. This displays the Create Copy Operation dialog.

    • In the From side, set Type to Variable, and select Variables > Process > Variables > customerServiceResponse > parameters > ns8:findCustomerByIdResponse > ns8:return > ns8:lname.

    • In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:ShipTo > ns1:Name > ns1:Last.

    Figure 8-77 Create Copy Operation Dialog for "AssignCustomerResponse" Activity, Second Copy Operation

    Description of Figure 8-77 follows
    Description of "Figure 8-77 Create Copy Operation Dialog for "AssignCustomerResponse" Activity, Second Copy Operation"

    Click OK in the Create Copy Operation dialog.

  7. You should see two copy operations in the Assign dialog. Click OK.

    Figure 8-78 Assign Dialog for the "AssignCustomerResponse" Activity

    Description of Figure 8-78 follows
    Description of "Figure 8-78 Assign Dialog for the "AssignCustomerResponse" Activity"

  8. Select File > Save to save your work.

8.8.8 Minimize the "CustomerService" Scope

Click the [-] icon to minimize the "CustomerService" scope.

 

8.9 Verify the Customer's Credit Card ("CreditService" Scope)

This scope verifies the credit of the customer. If a customer does not pass the credit check, the scope throws a fault and does not continue with the rest of the flow.

Figure 8-79 shows the activities in the "CreditService" scope.

Figure 8-79 Activities in the CreditService Scope

Description of Figure 8-79 follows
Description of "Figure 8-79 Activities in the CreditService Scope"

8.9.1 Create "CreditValidatingService" Partner Link

The "CreditService" scope uses the CreditService created in Chapter 5, "Creating the CreditService Project". The "CreditValidatingService" partner link is the interface to the CreditService.

  1. Copy the following file from the soademo_101310_prod.zip file to the SOAOrderBooking\bpel directory.

    • CreditValidatingService.wsdl

    In the soademo_101310_prod.zip file, the CreditValidatingService.wsdl file is located in the SOAOrderBooking\bpel directory.

  2. Verify the URL in the CreditValidatingService.wsdl file.

    1. In JDeveloper, select File > Open and open the CreditValidatingService.wsdl file.

    2. Click the Source tab at the bottom of the editor to view the lines in the file.

    3. The http://localhost:8888 reference in the file assumes that Oracle Application Server is running on the same machine as JDeveloper, and that Oracle Application Server is listening for requests on port 8888.

      If necessary, change localhost to the name of the machine running Oracle Application Server, and 8888 to the correct port used by your Oracle Application Server installation, for example: mypc.mydomain.com:8889.

    4. If you edited the file, save the file and close it.

  3. In the Component Palette, select Services from the dropdown.

  4. Drag the Partner Link icon from the Component Palette and drop it in a Services swimlane.

  5. In the Create Partner Link dialog:

    • Name: enter CreditValidatingService.

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

      Figure 8-80 Service Explorer Dialog for "CreditValidatingService" Partner Link

      Description of Figure 8-80 follows
      Description of "Figure 8-80 Service Explorer Dialog for "CreditValidatingService" Partner Link"

      Click OK in the Service Explorer.

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

    • Partner Role: select ValidateCreditCard_Role.

    • My Role: leave it blank.

    The Create Partner Link dialog should look like this:

    Figure 8-81 Create Partner Link for the "CreditValidatingService" Partner Link

    Description of Figure 8-81 follows
    Description of "Figure 8-81 Create Partner Link for the "CreditValidatingService" Partner Link"

    Click OK in the Create Partner Link dialog.

8.9.2 Create the "CreditService" Scope

Create a new scope called "CreditService".

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag the Scope icon from the Component Palette and drop it below the "CustomerService" scope.

  3. Double-click the new scope to display the Scope dialog.

  4. In the Scope dialog, in the General tab:

    • Name: enter CreditService.

    • Variable Access Serializable: do not select.

  5. Click the Variables tab. You need to create two variables for this scope.

  6. In the Variables tab, click Create.

  7. In the Create Variable dialog:

    • Name: enter validateRequest.

    • Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > CreditValidatingService > CreditValidatingService.wsdl > Imported WSDL > ValidateCreditCardServiceSoapHttp > Message Types > CreditCardValidationRequestMessage.

      Figure 8-82 Type Chooser Dialog for the "validateRequest" Variable

      Description of Figure 8-82 follows
      Description of "Figure 8-82 Type Chooser Dialog for the "validateRequest" Variable"

      Click OK in the Type Chooser.

  8. In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/credit}CreditCardValidationRequestMessage.

    Figure 8-83 Create Variable Dialog for the "validateRequest" Variable

    Description of Figure 8-83 follows
    Description of "Figure 8-83 Create Variable Dialog for the "validateRequest" Variable"

  9. Click OK in the Create Variable dialog.

  10. Click Create again to create a second variable.

  11. In the Create Variable dialog:

    • Name: enter validateResponse.

    • Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > CreditValidatingService > CreditValidatingService.wsdl > Imported WSDL > ValidateCreditCardServiceSoapHttp > Message Types > CreditCardValidationResponseMessage.

      Figure 8-84 Type Chooser Dialog for the "validateResponse" Variable

      Description of Figure 8-84 follows
      Description of "Figure 8-84 Type Chooser Dialog for the "validateResponse" Variable"

      Click OK in the Type Chooser.

  12. In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/credit}CreditCardValidationResponseMessage.

    Figure 8-85 Create Variable Dialog for the "validateResponse" Variable

    Description of Figure 8-85 follows
    Description of "Figure 8-85 Create Variable Dialog for the "validateResponse" Variable"

  13. Click OK in the Create Variable dialog.

  14. The validateRequest and validateResponse variables appear in the Variables tab of the Scope dialog.

    Figure 8-86 Scope Dialog for the "CreditService" Scope

    Description of Figure 8-86 follows
    Description of "Figure 8-86 Scope Dialog for the "CreditService" Scope"

    Click OK in the Scope dialog.

  15. Select File > Save to save your work.

8.9.3 Assign the Credit Card Number and Credit Card Type Information ("InitializeRequest" Assign Activity)

This assign activity copies the credit card number and type (which were retrieved from the CustomerService's findCustomerById operation) to the validateRequest variable.

  1. Expand the "CreditService" scope.

  2. Drag the Assign activity icon from the Component Palette and drop it in the "CreditService" scope.

  3. Double-click the new assign activity to display the Assign dialog.

  4. In the Assign dialog, click the General tab, and set the Name to InitializeRequest.

  5. Still in the Assign dialog, click the Copy Operation tab. You will create two copy operations.

  6. Create the first copy operation: Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.

    • In the From side, set Type to Variable, and select Variables > Process > Variables > customerServiceResponse > parameters > ns8:findCustomerByIdResponse > ns8:return > ns8:creditcardnumber.

    • In the To side, set Type to Variable, and select Variables > Process > Scope - Credit Service > Variables > validateRequest > CreditCard > ns11:CreditCard > ccNum.

    Figure 8-87 Create Copy Operation Dialog for the "InitializeRequest" Activity, First Copy Operation

    Description of Figure 8-87 follows
    Description of "Figure 8-87 Create Copy Operation Dialog for the "InitializeRequest" Activity, First Copy Operation"

    Click OK in the Create Copy Operation dialog.

  7. Create the second copy operation: Select Copy Operation from the Create dropdown again. This displays the Create Copy Operation dialog.

    • In the From side, set Type to Variable, and select Variables > Process > Variables > customerServiceResponse > parameters > ns8:findCustomerByIdResponse > ns8:return > ns8:creditcardtype.

    • In the To side, set Type to Variable, and select Variables > Process > Scope - Credit Service > Variables > validateRequest > CreditCard > ns11:CreditCard > ccType.

    Figure 8-88 Create Copy Operation Dialog for the "InitializeRequest" Activity, Second Copy Operation

    Description of Figure 8-88 follows
    Description of "Figure 8-88 Create Copy Operation Dialog for the "InitializeRequest" Activity, Second Copy Operation"

    Click OK in the Create Copy Operation dialog.

  8. You should see the copy operations in the Assign dialog. Click OK.

    Figure 8-89 Assign Dialog for the "InitializeRequest" Activity

    Description of Figure 8-89 follows
    Description of "Figure 8-89 Assign Dialog for the "InitializeRequest" Activity"

8.9.4 Verify the Customer's Credit Card ("InvokeCreditService" Invoke Activity)

This invoke activity checks whether or not the customer's credit card is valid. The invoke activity uses the values assigned in the previous assign activity.

  1. Drag the Invoke icon from the Component Palette and drop it below the "InitializeRequest" activity.

  2. Do one of the following to display the Invoke dialog:

    • Drag one of the arrows on the side of the Invoke_1 activity and drop it on the "CreditValidatingService" partner link. This associates the invoke activity with the partner link.

    • Double-click the new Invoke_1 activity.

  3. In the Invoke dialog, set these values:

    The Invoke dialog should look like this:

    Figure 8-93 Invoke Dialog for the "InvokeCreditService" Activity

    Description of Figure 8-93 follows
    Description of "Figure 8-93 Invoke Dialog for the "InvokeCreditService" Activity"

  4. Click OK in the Invoke dialog.

  5. Select File > Save to save your work.

8.9.5 Create the "OrderBookingFault" Process Variable

Create the OrderBookingFault variable in the SOAOrderBooking scope. This variable is created at this level so that any activity in this BPEL flow can access it.

  1. Scroll to the top of the page and double-click the SOAOrderBooking scope. You can double-click the "SOAOrderBooking" text that is sideways. This displays the Process dialog.

  2. In the Process dialog, click Create in the Variables tab. This displays the Create Variable dialog.

  3. In the Create Variable dialog:

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

    Figure 8-95 Create Variable Dialog for the "OrderBookingFault" Process Variable

    Description of Figure 8-95 follows
    Description of "Figure 8-95 Create Variable Dialog for the "OrderBookingFault" Process Variable"

  4. Click OK in the Create Variable dialog. The OrderBookingFault variable appears in the Process dialog.

    Figure 8-96 Process Dialog

    Description of Figure 8-96 follows
    Description of "Figure 8-96 Process Dialog"

  5. Select File > Save to save your work.

8.9.6 Check the Results of the Credit Card Validation (Switch Activity)

This switch checks the result of the "InvokeCreditService" invoke activity. If the customer's credit card is valid, the flow continues. If the customer's credit card is not valid, the switch throws a fault.

  1. Drag the Switch icon from the Component Palette and drop it below the "InvokeCreditService" activity.

  2. Expand the switch.

  3. Delete the <otherwise> case. This switch only handles invalid credit responses, for which it throws a fault. For credit cards that are valid, the switch does not apply to them and for those cases, they just continue to the next step in the flow.

8.9.6.1 Specify the Condition for <case>

For the <case> branch, you want to handle cases where a customer's credit is not valid. This information is stored in the validateResponse variable.

  1. Double-click the title bar of the <case> box to display the Switch Case dialog.

  2. In the Switch Case dialog, click the XPath Expression Builder icon above the Expression box to display the Expression Builder dialog.

  3. In the Expression Builder dialog, in the BPEL Variables box, select Variables > Process > Scope - CreditService > Variables > validateResponse > valid > ns11:valid.

    The Content Preview box should show bpws:getVariableData('validateResponse', 'valid', 'ns11:valid').

    The ns11 prefix maps to the "http://www.globalcompany.com/ns/credit.xsd" namespace. It may be different on your system. If you want, you can scroll to the top of your SOAOrderBooking.bpel file (in source view) to verify the prefix.

  4. Click Insert Into Expression. The Expression box should show the function with the three parameters.

  5. Append ='false' to the expression in the Expression box so that the expression looks like this:

    bpws:getVariableData('validateResponse','valid','/ns11:valid')='false'
    
    

    Figure 8-97 Expression Builder Dialog Showing the Complete Expression for <case>

    Description of Figure 8-97 follows
    Description of "Figure 8-97 Expression Builder Dialog Showing the Complete Expression for <case>"

  6. Click OK in the Expression Builder dialog.

  7. Click OK in the Switch Case dialog.

8.9.6.2 Set the Value of the OrderBookingFault Variable ("AssignFault" Assign Activity)

This assign activity sets the value of the OrderBookingFault variable to "credit problem".

  1. Drag the Assign activity icon from the Component Palette and drop it in the <case> area of the switch.

  2. Double-click the new assign activity to display the Assign dialog.

  3. In the Assign dialog, click the General tab, and set the Name to AssignFault.

  4. Still in the Assign dialog, click the Copy Operation tab. You will create one copy operation.

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

    • In the From side, set Type to Expression, and enter the following line in the Expression box:

      string('credit problem')

    • In the To side, set Type to Variable, and select Variables > Process > Variables > OrderBookingFault > payload > client:SOAOrderBookingProcessFault > client:status.

    Figure 8-98 Create Copy Operation Dialog for the "AssignFault" Activity

    Description of Figure 8-98 follows
    Description of "Figure 8-98 Create Copy Operation Dialog for the "AssignFault" Activity"

    Click OK in the Create Copy Operation dialog.

  6. You should see the copy operation in the Assign dialog. Click OK.

    Figure 8-99 Assign Dialog for the "AssignFault" Activity

    Description of Figure 8-99 follows
    Description of "Figure 8-99 Assign Dialog for the "AssignFault" Activity"

8.9.6.3 Create the "ThrowCreditFault" Throw Activity

This throw activity throws a fault called OrderBookingFault. This fault value is stored in a variable also called OrderBookingFault. The SOAOrderBooking process terminates after executing the throw activity.

  1. Drag the Throw icon from the Component Palette and drop it below the "AssignFault" activity.

  2. Double-click the new throw activity to display the Throw dialog.

  3. In the Throw dialog:

    • Name: enter ThrowCreditFault.

    • Namespace URI: enter http://www.globalcompany.com/ns/OrderBooking. You have to enter it manually.

    • Local Part: enter OrderBookingFault. You have to enter it manually.

    • Fault Variable: click the flashlight and select OrderBookingFault.

    Figure 8-100 Throw Dialog for the "ThrowCreditFault" Throw Activity

    Description of Figure 8-100 follows
    Description of "Figure 8-100 Throw Dialog for the "ThrowCreditFault" Throw Activity"

  4. Click OK in the Throw dialog.

  5. Select File > Save to save your work.

8.9.7 Minimize the "CreditService" Scope

Click the [-] to minimize the "CreditService" scope.

 

8.10 Set up Oracle Business Rules

The repository for Oracle Business Rules contains the rules used by the decision service in Oracle BPEL Process Manager to determine whether or not an order needs to be approved manually by a manager. The Oracle Business Rules repository is separate from the SOA Order Booking application: you can edit the rules without modifying and redeploying the SOA Order Booking application.

The rules that you will create in the repository are:

8.10.1 Set up the Repository File

To create a repository file for Oracle Business Rules and to define the rules in it, you use Oracle Business Rules Rule Author ("Rule Author"), which is a Web-based tool that enables you to create and manage Oracle Business Rules repositories.

Location of the Repository File

Create the repository file in the SOAOrderBooking\bpel\rules\oracle directory.

However, if you are running JDeveloper and Oracle Application Server on different machines, you have to create the repository file on the Oracle Application Server machine (because Rule Author creates the file on the Oracle Application Server machine). After you have created the repository file and populated it with rules, you copy it from the Oracle Application Server machine to the JDeveloper machine.

  1. Create the following directory where you are building the SOA Order Booking application:

    SOADEMO\SOAOrderBooking\bpel\rules\oracle\

    This is the directory where you will place the Oracle Business Rules repository file.

  2. In a browser, go to the Rule Author page. The URL for Rule Author is:

    http://host:port/ruleauthor

    host specifies the machine running Oracle Application Server, and port specifies the HTTP port (for example, 8888).

  3. Log in as the oc4jadmin user.

  4. In the Repository tab:

    • Repository Type: select File.

    • File Location: enter SOADEMO\SOAOrderBooking\bpel\rules\oracle\sample_repository. (SOADEMO refers to the directory where you are building the SOA Order Booking application.) Rule Author will create the sample_repository file.

      If you are running JDeveloper and Oracle Application Server on different machines, enter a path on the Oracle Application Server machine, for example, C:\rules\sample_repository. It does not matter where you place it, because after creating the file and defining the rules in it, you copy it from the Oracle Application Server machine to the SOADEMO\SOAOrderBooking\bpel\rules\oracle\ directory on the JDeveloper machine.

    Figure 8-101 Rule Author, Connect Page

    Description of Figure 8-101 follows
    Description of "Figure 8-101 Rule Author, Connect Page"

    Click Create. You should see a confirmation page. Rule Author is now connected to the new repository, and you can define rules in it.

    Figure 8-102 Rule Author, Confirmation Page

    Description of Figure 8-102 follows
    Description of "Figure 8-102 Rule Author, Confirmation Page"

8.10.2 Create a Dictionary in the Repository

A repository contains one or more dictionaries. A dictionary contains rulesets, which contain rules. A dictionary typically contains rulesets for an application.

  1. Click the Create secondary tab on the Confirmation page. This displays the Create Dictionary page.

  2. On the Create Dictionary page, enter OrderBookingRules as the dictionary name.

    Figure 8-103 Rule Author, Create Dictionary Page

    Description of Figure 8-103 follows
    Description of "Figure 8-103 Rule Author, Create Dictionary Page"

  3. Click Create. You should get a confirmation page.

    Figure 8-104 Rule Author, Create Dictionary Page, Confirmation

    Description of Figure 8-104 follows
    Description of "Figure 8-104 Rule Author, Create Dictionary Page, Confirmation"

8.10.3 Copy OrderBookingRules.xsd to the Oracle Application Server Machine

This step is required only if you are running JDeveloper and Oracle Application Server on different machines. If you are running both on the same machine, you already have the OrderBookingRules.xsd file on the Oracle Application Server machine (you copied the file in Section 8.3, "Copy Files").

The OrderBookingRules.xsd file in the soademo_101310_prod.zip file describes the XML elements that provide the facts for Oracle Business Rules. The XSD file is located in the SOAOrderBooking\bpel directory in the zip file.

If you are running JDeveloper and Oracle Application Server on different machines, copy this file from the soademo_101310_prod.zip file to the Oracle Application Server machine, to the directory where you placed the repository file (for example, C:\rules). See step 4.

In Section 8.10.4, "Generate JAXB Classes for the Elements in the XML Schema", you use Rule Author to generate Java classes for the XML elements defined in OrderBookingRules.xsd.

8.10.4 Generate JAXB Classes for the Elements in the XML Schema

Use Rule Author to generate Java objects for the elements in the OrderBookingRules.xsd file.

  1. Click the Definitions tab, then click XMLFact on the left side. This displays the XML Fact Summary page. At this time, the OrderBookingRules dictionary does not contain any XML facts.

    Figure 8-105 XML Fact Summary Page

    Description of Figure 8-105 follows
    Description of "Figure 8-105 XML Fact Summary Page"

  2. Click Create.

  3. On the XML Schema Selector page:

    • XML Schema: enter the fullpath to the OrderBookingRules.xsd file.

      If you are running JDeveloper and Oracle Application Server on the same machine, enter SOADEMO\SOAOrderBooking\bpel\OrderBookingRules.xsd.

      If you are running JDeveloper and Oracle Application Server on different machines, enter C:\rules\OrderBookingRules.xsd.

    • JAXB Class Directory: enter the fullpath to the directory where you want Rule Author to create the Java objects (.java and .class files).

      If you are running JDeveloper and Oracle Application Server on the same machine, enter SOADEMO\SOAOrderBooking\bpel\rules.

      If you are running JDeveloper and Oracle Application Server on different machines, enter C:\rules.

    • Target Package Name: enter com.oracle.demos.orderbooking. This specifies the package name for the classes that are to be created.

    Figure 8-106 XML Schema Selector Page

    Description of Figure 8-106 follows
    Description of "Figure 8-106 XML Schema Selector Page"

  4. Click Add Schema.

    Figure 8-107 shows the resulting page with the package hierarchy expanded.

    Figure 8-107 XML Schema Selector Page, Showing the Generated Classes

    Description of Figure 8-107 follows
    Description of "Figure 8-107 XML Schema Selector Page, Showing the Generated Classes"

In the directory that you specified in the JAXB Class Directory field, you should see the following files:

  • Approve.java and Approve.class

  • ApproveImpl.java and ApproveImpl.class

  • ApproveType.java and ApproveType.class

  • ApproveTypeImpl.java and ApproveTypeImpl.class

  • jaxb.properties

  • ObjectFactory.java and ObjectFactory.class

8.10.5 Import the JAXB Classes into the Oracle Business Rules Data Model

After generating the JAXB classes, you can import them into the Oracle Business Rules data model. These JAXB classes become XML facts that you can use when you create your rules.

  1. If you are not on the XML Schema Selector page, click the Definitions tab, then click XML Fact on the left side, then click Create on the XMLFact Summary page.

  2. Select the check box next to com.

    Figure 8-108 XML Schema Selector Page, with "com" Selected

    Description of Figure 8-108 follows
    Description of "Figure 8-108 XML Schema Selector Page, with "com" Selected"

  3. Click Import. You should see a confirmation page. The classes that have been imported are shown in bold. Also on the left side, note that there are now three XML Facts.

    Figure 8-109 XML Schema Selector Page Showing the Imported Classes

    Description of Figure 8-109 follows
    Description of "Figure 8-109 XML Schema Selector Page Showing the Imported Classes"

8.10.6 Define a Variable in the Data Model

You define variables in the data model so that if you need to make changes later, you only need to edit the value of the variable. In the case of the SOA Order Booking application, you create a variable called AUTOMATED_ORDER_LIMIT to define the dollar amount where orders above this amount would need manual approval from a manager and orders under this amount are approved automatically.

  1. In the Definitions tab, click Variable on the left side.

  2. In the Variable Summary page, click Create.

  3. On the Variable page:

    • Name: enter AUTOMATED_ORDER_LIMIT.

    • Alias: enter AUTOMATED_ORDER_LIMIT.

    • Final: select this option.

    • Type: select float.

    • Expression: enter 1000.00.

    Figure 8-110 Variable Page

    Description of Figure 8-110 follows
    Description of "Figure 8-110 Variable Page"

  4. Click OK. Rule Author shows the Variable Summary page. Note that the variable name is prefixed with DM (for "data model").

    Figure 8-111 Variable Summary Page

    Description of Figure 8-111 follows
    Description of "Figure 8-111 Variable Summary Page"

8.10.7 Create a Ruleset

A ruleset contains rules. Before you can create rules, you need a ruleset.

  1. Click the Rulesets tab. This displays the RuleSet Summary page.

  2. On the RuleSet Summary page, click Create. This displays the Ruleset page.

  3. On the Ruleset page, enter ApproveOrderRequired as the Name. You can also enter a description if you like.

    Figure 8-112 Ruleset Page

    Description of Figure 8-112 follows
    Description of "Figure 8-112 Ruleset Page"

  4. Click OK. You should see the RuleSet Summary page showing the new ruleset. The new ruleset also appears on the left side.

    Figure 8-113 RuleSet Summary Page

    Description of Figure 8-113 follows
    Description of "Figure 8-113 RuleSet Summary Page"

8.10.8 Create Rules

You can now define your rules in the "ApproveOrderRequired" ruleset. For the SOA Order Booking application, create the following three rules:

Table 8-4 Rules

Rule Name Description

belowLimit

If an order's total price is less than the value set in the AUTOMATED_ORDER_LIMIT variable, the order is approved automatically. See Section 8.10.8.1, "Create the "belowLimit" Rule".

overLimit

If an order's total price is greater than or equal to the value set in the AUTOMATED_ORDER_LIMIT variable and the customer is not a platinum customer, the order requires a manager's approval. See Section 8.10.8.2, "Create the "overLimit" Rule".

platinumMember

If the customer is a platinum customer, the order is approved automatically, regardless of the order amount. See Section 8.10.8.3, "Create the "platinumMember" Rule".


8.10.8.1 Create the "belowLimit" Rule

The "belowLimit" rule states that if an order's total price is less than the value set in the AUTOMATED_ORDER_LIMIT variable, the order is approved automatically.

  1. Click the Rulesets tab.

  2. Click the ApproveOrderRequired ruleset on the left side. This displays the Ruleset page.

    Figure 8-114 Ruleset Page for the "ApproveOrderRequired" Ruleset

    Description of Figure 8-114 follows
    Description of "Figure 8-114 Ruleset Page for the "ApproveOrderRequired" Ruleset"

  3. In the Rules section, click Create. This displays the Rule page.

  4. On the Rule page, enter belowLimit for the Name. Keep the default value for Priority.

  5. In the "If" section, click New Pattern. This pops up the Pattern Definition window.

  6. In the Pattern Definition window, in the Choose Pattern section:

    • Do not choose anything from the first field (that is, leave it empty).

    • Enter approve in the second field.

    • Select ApproveType from the dropdown.

  7. In the Define Test for Pattern section, click Create. Then fill in the section as follows:

    • Operand: select approve.price.

    • Operator: select < (less than).

    • Operand (choose Value or Field): select AUTOMATED_ORDER_LIMIT under Field. Select Fixed in the dropdown.

    The Pattern Definition window should look like this:

    Figure 8-115 Pattern Definition for "belowLimit" Rule

    Description of Figure 8-115 follows
    Description of "Figure 8-115 Pattern Definition for "belowLimit" Rule"

  8. Click Apply in the Pattern Definition window. You should see a confirmation message at the top of the Pattern Definition window.

  9. Click OK to return to the Rule page, which now looks like this:

    Figure 8-116 Rule Page for the "belowLimit" Rule

    Description of Figure 8-116 follows
    Description of "Figure 8-116 Rule Page for the "belowLimit" Rule"

  10. Click Apply on the Rule page. You should see a confirmation message at the top of the Rule page.

  11. In the "Then" section of the Rule page, click New Action. This pops up the Add Action window.

  12. In the Add Action window:

    • Action Type: select Assign.

    • Name: select approve.approvalRequired.

    • Expression: enter false.

    Figure 8-117 Add Action for the "belowLimit" Rule

    Description of Figure 8-117 follows
    Description of "Figure 8-117 Add Action for the "belowLimit" Rule"

  13. Click Apply.

  14. Click OK to return to the Rule page, which now looks like this:

    Figure 8-118 Rule Page for the "belowLimit" Rule

    Description of Figure 8-118 follows
    Description of "Figure 8-118 Rule Page for the "belowLimit" Rule"

  15. Click Apply.

  16. Save your work. Click the Save Dictionary link at the top of the page, then click Save on the Save Dictionary page.

8.10.8.2 Create the "overLimit" Rule

The "overLimit" rule states that if an order's total price is greater than or equal to the value set in the AUTOMATED_ORDER_LIMIT variable and the customer is not a platinum customer, the order requires a manager's approval. If the customer is a platinum customer, then the order is approved automatically, regardless of the amount of the order.

  1. Click the Rulesets tab.

  2. Click the ApproveOrderRequired ruleset on the left side. This displays the Ruleset page. The "belowLimit" rule is already created.

    Figure 8-119 Ruleset Page for the "ApproveOrderRequired" Ruleset

    Description of Figure 8-119 follows
    Description of "Figure 8-119 Ruleset Page for the "ApproveOrderRequired" Ruleset"

  3. In the Rules section, click Create. This displays the Rule page.

  4. On the Rule page, enter overLimit for the Name. Keep the default value for Priority.

  5. In the "If" section, click New Pattern. This pops up the Pattern Definition window.

  6. In the Pattern Definition window, in the Choose Pattern section:

    • Do not choose anything from the first field (that is, leave it empty).

    • Enter approve in the second field.

    • Select ApproveType from the dropdown.

  7. In the Define Test for Pattern section, click Create. Then fill in the section as follows.

    • Operand: select approve.price.

    • Operator: select >= (greater than or equal to).

    • Operand (choose Value or Field): select AUTOMATED_ORDER_LIMIT under Field. Select Fixed in the dropdown.

    The Pattern Definition window should look like this:

    Figure 8-120 Pattern Definition for the "overLimit" Rule (part 1 of 2)

    Description of Figure 8-120 follows
    Description of "Figure 8-120 Pattern Definition for the "overLimit" Rule (part 1 of 2)"

  8. Click Create again to define the second test. Fill in the section as follows.

    • Operand: select approve.status.

    • Operator: select != (not equal to).

    • Operand (choose Value or Field): enter "Platinum" (include the double-quote characters) under Value. Select Fixed in the dropdown.

    The Pattern Definition window should look like this:

    Figure 8-121 Pattern Definition for the "overLimit" Rule (part 2 of 2)

    Description of Figure 8-121 follows
    Description of "Figure 8-121 Pattern Definition for the "overLimit" Rule (part 2 of 2)"

  9. Click Apply in the Pattern Definition window. You should see a confirmation message at the top of the Pattern Definition window.

  10. Click OK to return to the Rule page.

  11. The Rule page now looks like this:

    Figure 8-122 Rule Page for the "overLimit" Rule

    Description of Figure 8-122 follows
    Description of "Figure 8-122 Rule Page for the "overLimit" Rule"

  12. Click Apply on the Rule page. You should see a confirmation message at the top of the Rule page.

  13. In the "Then" section of the Rule page, click New Action. This pops up the Add Action window.

  14. In the Add Action window:

    • Action Type: select Assign.

    • Name: select approve.approvalRequired.

    • Expression: enter true.

    Figure 8-123 Add Action for the "overLimit" Rule

    Description of Figure 8-123 follows
    Description of "Figure 8-123 Add Action for the "overLimit" Rule"

  15. Click Apply.

  16. Click OK to return to the Rule page, which now looks like this:

    Figure 8-124 Rule Page for the "overLimit" Rule

    Description of Figure 8-124 follows
    Description of "Figure 8-124 Rule Page for the "overLimit" Rule"

  17. Click Apply.

  18. Save your work. Click the Save Dictionary link at the top of the page, then click Save in the Save Dictionary page.

8.10.8.3 Create the "platinumMember" Rule

The "platinumMember" rule states that if a customer is a platinum customer, the order is approved automatically, regardless of the amount of the order.

  1. Click the Rulesets tab.

  2. Click the ApproveOrderRequired ruleset on the left side. This displays the Ruleset page. The "belowLimit" and "overLimit" rules are already created.

    Figure 8-125 Ruleset Page for the "ApproveOrderRequired" Ruleset

    Description of Figure 8-125 follows
    Description of "Figure 8-125 Ruleset Page for the "ApproveOrderRequired" Ruleset"

  3. In the Rules section, click Create. This displays the Rule page.

  4. On the Rule page, enter platinumMember for the Name. Keep the default value for Priority.

  5. In the "If" section, click New Pattern. This pops up the Pattern Definition window.

  6. In the Pattern Definition window, in the Choose Pattern section:

    • Do not choose anything from the first field (that is, leave it empty).

    • Enter approve in the second field.

    • Select ApproveType from the dropdown.

  7. In the Define Test for Pattern section, click Create. Then fill in the section as follows.

    • Operand: select approve.status.

    • Operator: select == (equal to).

    • Operand (choose Value or Field): enter "Platinum" (include the double-quote characters) under Value. Select Fixed in the dropdown.

    The Pattern Definition window should look like this:

    Figure 8-126 Pattern Definition for the "platinumMember" Rule

    Description of Figure 8-126 follows
    Description of "Figure 8-126 Pattern Definition for the "platinumMember" Rule"

  8. Click Apply in the Pattern Definition window. You should see a confirmation message at the top of the Pattern Definition window.

  9. Click OK to return to the Rule page.

  10. The Rule page now looks like this:

    Figure 8-127 Rule Page for the "platinumMember" Rule

    Description of Figure 8-127 follows
    Description of "Figure 8-127 Rule Page for the "platinumMember" Rule"

  11. Click Apply on the Rule page. You should see a confirmation message at the top of the Rule page.

  12. In the "Then" section of the Rule page, click New Action. This pops up the Add Action window.

  13. In the Add Action window:

    • Action Type: select Assign.

    • Name: select approve.approvalRequired.

    • Expression: enter false.

    Figure 8-128 Add Action for the "platinumMember" Rule

    Description of Figure 8-128 follows
    Description of "Figure 8-128 Add Action for the "platinumMember" Rule"

  14. Click Apply.

  15. Click OK to return to the Rule page, which now looks like this:

    Figure 8-129 Rule Page for the "platinumMember" Rule

    Description of Figure 8-129 follows
    Description of "Figure 8-129 Rule Page for the "platinumMember" Rule"

  16. Click Apply.

  17. Save your work. Click the Save Dictionary link at the top of the page, then click Save on the Save Dictionary page.

8.10.9 Log out of Rule Author

Click the Logout link at the top of the page.

On the Logout Confirmation page, click Save and Logout.

8.10.10 Copy the Files to the JDeveloper Machine

This section is applicable only if you are running JDeveloper and Oracle Application Server on different machines. If you are running both on the same machine, then the files are already on the JDeveloper machine.

Copy the files generated by Rule Author from the Oracle Application Server machine to the JDeveloper machine:

  • Copy the c:\rules\sample_repository file to the SOADEMO\SOAOrderBooking\bpel\rules\oracle directory.

  • Copy the files from c:\rules\com\oracle\demos\orderbooking to the SOADEMO\SOAOrderBooking\bpel\rules\com\oracle\demos\orderbooking directory.

 

8.11 Determine If an Order Requires Manual Approval ("RequiresManualApproval" Decide Activity)

This decide activity checks if an order requires to be approved by a manager. It determines this by checking the rules in the Oracle Business Rules repository. You created the rules in Section 8.10, "Set up Oracle Business Rules".

Figure 8-130 shows the activities in the "RequiresManualApproval" decide activity.

Figure 8-130 Activities in the "RequiresManualApproval" Decide Activity

Description of Figure 8-130 follows
Description of "Figure 8-130 Activities in the "RequiresManualApproval" Decide Activity"

8.11.1 Create the Activities in the "RequiresManualApproval" Decide Activity

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag the Decide icon from the Component Palette and drop it after the "CreditService" scope. This displays the Edit Decide dialog.

  3. In the Edit Decide dialog, enter RequiresManualApproval in the Name field.

  4. For the Decision Service field, click the wand icon. This launches the Decision Service wizard.

  5. In Step 1, Select a Ruleset or Function:

    • Service Name: enter DecisionService (which is the default name).

    • Namespace: enter http://www.globalcompany.com/ns/OrderBooking/DecisionService (which is the default).

    • Invocation Pattern: select Execute Ruleset.

    • Ruleset: click the flashlight icon, which displays the Rule Explorer. In the Rule Explorer, you should see sample_repository. Expand it, then expand OrderBookingRules (which is the name of the dictionary), and select ApproveOrderRequired (which is the name of the ruleset).

      Figure 8-131 Rule Explorer

      Description of Figure 8-131 follows
      Description of "Figure 8-131 Rule Explorer"

      Click OK in the Rule Explorer.

  6. Back in step 1 of the wizard, select Assert Fact and Watch Fact for Approve.

    Check here to assert all descendants from the top level element: do not select.

    Figure 8-132 Decision Service Wizard, Step 1, Select a Ruleset or Function

    Description of Figure 8-132 follows
    Description of "Figure 8-132 Decision Service Wizard, Step 1, Select a Ruleset or Function"

    Click Next.

  7. If the wizard complains about missing files, copy the files that it wants to the desired location. This screen is likely to appear if you are running JDeveloper and Oracle Application Server on separate machines and you copied the Oracle Business Rules repository from the Oracle Application Server machine to the JDeveloper machine.

    Figure 8-133 Decision Service Wizard, Step 2, Copy XSD Files

    Description of Figure 8-133 follows
    Description of "Figure 8-133 Decision Service Wizard, Step 2, Copy XSD Files"

    Click Next.

  8. On the Finish page, click Finish.

  9. Back to the Edit Decide dialog:

    • Decision Service: set to DecisionService automatically.

    • Operation: select Assert facts, execute rule set, retrieve results.

    The Edit Decide dialog now looks like this:

    Figure 8-134 Edit Decide Dialog

    Description of Figure 8-134 follows
    Description of "Figure 8-134 Edit Decide Dialog"

    Click OK.

  10. Select File > Save to save your work.

JDeveloper creates the following items:

  • the SOAOrderBooking\decisionservices directory

  • the "DecisionServicePL" partner link

  • the following activities in the "RequiresManualApproval" decide activity (expand "RequiresManualApproval" to see the activities):

    • Assign activity: "BPEL_Var_To_Rule_Facts"

    • Assign activity: "Facts_To_Rule_Service"

    • Assign activity: "BPEL_Header"

    • Invoke activity: "Invoke"

    • Assign activity: "Rule_Service_To_Facts"

    • Assign activity: "Facts_To_BPEL_Var"

    If JDeveloper displays these activities in a somewhat random order, save and close the SOAOrderBooking.bpel file. Then reopen it.

  • the following variables in the "RequiresManualApproval" decide activity:

    • com_oracle_demos_orderbooking_Approve_i

    • com_oracle_demos_orderbooking_Approve_o

    • dsIn

    • dsOut

    To see these variables, click the (x) icon on the left side of the "RequiresManualApproval" decide activity (Figure 8-135). This displays the Variables dialog (Figure 8-136).

    Figure 8-135 The Red Circle Highlights the Variable Icon for the "RequiresManualApproval" Decide Activity

    Description of Figure 8-135 follows
    Description of "Figure 8-135 The Red Circle Highlights the Variable Icon for the "RequiresManualApproval" Decide Activity"

    You should see these variables:

    Figure 8-136 Variables Dialog

    Description of Figure 8-136 follows
    Description of "Figure 8-136 Variables Dialog"

8.11.2 Copy Order Total and Customer Status Information ("BPEL_Var_To_Rule_Facts" Assign Activity)

The default "BPEL_Var_To_Rule_Facts" assign activity does not contain any operations. You have to define the operations yourself. For the SOA Order Booking application, you define two copy operations:

  • Copy the order total price to the com_oracle_demos_orderbooking_Approve_i variable. Copy it to the approve/price element of the variable.

  • Copy the status of the customer (retrieved from findCustomerById) to the com_oracle_demos_orderbooking_Approve_i variable. Copy it to the approve/status element of the variable.

  1. Double-click the "BPEL_Var_To_Rule_Facts" activity to display the Assign dialog.

  2. Click the Copy Operation tab. You will define two copy operations.

  3. For the first copy operation, select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.

    1. On the To side, set Type to Expression.

    2. Click the XPath Expression Builder icon above the Expression box to display the Expression Builder dialog. You will use the Expression Builder to create the expression.

    3. In the Expression Builder dialog, in the BPEL Variables box, select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns4:PurchaseOrder > ns4:OrderInfo > ns4:OrderPrice.

      The Content Preview box should show bpws:getVariableData('inputVariable', 'payload', '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:OrderInfo/ns4:OrderPrice').

      The ns4 prefix maps to the "http://www.globalcompany.com/ns/order" namespace. It may be different on your system. If you want, you can scroll to the top of your SOAOrderBooking.bpel file (in source view) to verify the prefix.

    4. Click Insert Into Expression. The Expression box should show the function with the three parameters.

    5. In the Expression box, wrap the number() function around the entire bpws:getVariableData function. The value in the Expression box should look like this:

      number(bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/
      ns4:OrderInfo/ns4:OrderPrice'))
      
      

      Figure 8-137 Expression Builder Dialog

      Description of Figure 8-137 follows
      Description of "Figure 8-137 Expression Builder Dialog"

    6. Click OK in the Expression Builder dialog.

    7. On the From side, set Type to Variable.

    8. Select Variables > Process > Scope - RequiresManualApproval > Variables > com_oracle_demos_orderbooking_Approve_i > ns13:approve > ns13:price.

      Figure 8-138 Create Copy Operation Dialog

      Description of Figure 8-138 follows
      Description of "Figure 8-138 Create Copy Operation Dialog"

    9. Click OK in the Create Copy Operation dialog. This returns you to the Assign dialog.

  4. Select Copy Operation from the Create dropdown again to create the second copy operation.

    1. On the To side, set Type to Expression.

    2. Click the XPath Expression Builder icon above the Expression box to display the Expression Builder dialog. You will use the Expression Builder to create the expression.

    3. In the Expression Builder dialog, in the BPEL Variables box, select Variables > Process > Variables > customerServiceResponse > parameters > ns8:findCustomerByIdResponse > ns8:return > ns8:status.

      The Content Preview box should show bpws:getVariableData('customerServiceResponse','parameters','/ns8:findCustomerByIdResponse/ns8:return/ns8:status').

      The ns8 prefix maps to the "http://www.globalcompany.com/ns/customer" namespace. It may be different on your system. If you want, you can scroll to the top of your SOAOrderBooking.bpel file (in source view) to verify the prefix.

    4. Click Insert Into Expression. The Expression box should show the function with the three parameters.

    5. In the Expression box, wrap the string() function around the entire bpws:getVariableData function. The value in the Expression box should look like this:

      string(bpws:getVariableData('customerServiceResponse','parameters',
      '/ns8:findCustomerByIdResponse/ns8:return/ns8:status'))
      
      

      Figure 8-139 Expression Builder Dialog

      Description of Figure 8-139 follows
      Description of "Figure 8-139 Expression Builder Dialog"

    6. Click OK in the Expression Builder dialog.

    7. On the From side, set Type to Variable.

    8. Select Variables > Process > Scope - RequiresManualApproval > Variables > com_oracle_demos_orderbooking_Approve_i > ns13:approve > ns13:status.

      Figure 8-140 Create Copy Operation Dialog

      Description of Figure 8-140 follows
      Description of "Figure 8-140 Create Copy Operation Dialog"

    9. Click OK in the Create Copy Operation dialog.

  5. Click OK in the Assign dialog.

  6. Select File > Save to save your work.

8.11.3 Copy the ConversationId to the dsIn Variable ("BPEL_Header" Assign Activity)

The default "BPEL_Header" assign activity comes with seven copy operations. Add another copy operation to copy the conversation ID to the dsIn variable.

  1. Double-click the "BPEL_Header" activity to display the Assign dialog.

  2. Click the Copy Operation tab.

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

    1. On the From side, set Type to Expression.

    2. Enter the following in the Expression box.

      ora:getConversationId()
      
      
    3. On the To side, set Type to Variable.

    4. Select Variables > Process > Scope - RequiresManualApproval > Variables > dsIn > payload > ns12:assertExecuteWatchStateful > ns12:bpelInstance > ns14:conversationId.

      Figure 8-141 Create Copy Operation Dialog

      Description of Figure 8-141 follows
      Description of "Figure 8-141 Create Copy Operation Dialog"

    5. Click OK in the Create Copy Operation dialog. This returns you to the Assign dialog.

  4. Click OK in the Assign dialog.

  5. Select File > Save to save your work.

8.11.4 Create the "requiresApproval" Process Variable

Create the requiresApproval variable in the SOAOrderBooking scope. This variable is created at this level so that any activity in this BPEL flow can access it.

This variable is used in the switch that you will create later in Section 8.12.2, "Set the Condition for the <case>".

  1. Scroll to the top of the page and double-click the SOAOrderBooking scope. You can double-click the "SOAOrderBooking" text that is sideways. This displays the Process dialog.

  2. In the Process dialog, click Create in the Variables tab. This displays the Create Variable dialog.

  3. In the Create Variable dialog:

    • Name: enter requiresApproval.

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

      In the Type Chooser, select boolean and click OK.

    The Create Variable dialog now looks like this:

    Figure 8-142 Create Variable Dialog for the "requiresApproval" Process Variable

    Description of Figure 8-142 follows
    Description of "Figure 8-142 Create Variable Dialog for the "requiresApproval" Process Variable"

  4. Click OK in the Create Variable dialog. The requiresApproval variable appears in the Process dialog.

    Figure 8-143 Process Dialog Showing the "requiresApproval" Variable

    Description of Figure 8-143 follows
    Description of "Figure 8-143 Process Dialog Showing the "requiresApproval" Variable"

  5. Click OK in the Process dialog.

  6. Select File > Save to save your work.

8.11.5 Copy the Result of the Decision Service to the requiresApproval Variable ("Facts_To_BPEL_Var" Assign Activity)

The default "Facts_To_BPEL_Var" assign activity does not come with any operations. Create a copy operation to copy the result returned by the "DecisionService" partner link to the requiresApproval process variable.

  1. Double-click the "Facts_To_BPEL_Var" assign activity to display the Assign dialog.

  2. Click the Copy Operation tab.

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

  4. On the From side, set Type to Variable.

  5. Select Variables > Process > Scope - RequiresManualApproval > Variables > dsOut > payload > ns12:assertExecuteWatchStatefulDecision > ns12:resultList > ns13:approve > ns13:approvalRequired.

  6. On the To side, set Type to Variable.

  7. Select Variables > Process > Variables > requiresApproval.

    Figure 8-144 Create Copy Operation Dialog

    Description of Figure 8-144 follows
    Description of "Figure 8-144 Create Copy Operation Dialog"

  8. Click OK in the Create Copy Operation dialog.

  9. You should see the copy operation in the Assign dialog. Click OK.

    Figure 8-145 Assign Dialog

    Description of Figure 8-145 follows
    Description of "Figure 8-145 Assign Dialog"

  10. Select File > Save to save your work.

8.11.6 Minimize the "RequiresManualApproval" Decide Activity

Click the [-] icon to minimize the "RequiresManualApproval" decide activity.

 

8.12 Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)

For orders that require manual approval, the "requiresApproval" switch passes control to a human task activity. This enables a manager to approve or reject the orders.

The "requiresApproval" consists of a <case> branch only. It does not have an <otherwise> branch. For orders that do not require manual approval, this switch does not apply to them.

The <case> branch contains a human task activity and another switch activity (Figure 8-146).

Figure 8-146 "requiresApproval" Switch Contains a Human Task and a Switch (Minimized View)

Description of Figure 8-146 follows
Description of "Figure 8-146 "requiresApproval" Switch Contains a Human Task and a Switch (Minimized View)"

Figure 8-147 shows the human task activity expanded.

Figure 8-148 shows the switch activity expanded.

Figure 8-147 <case> Branch for Switch Activity, Human Task Activity Expanded

Description of Figure 8-147 follows
Description of "Figure 8-147 <case> Branch for Switch Activity, Human Task Activity Expanded"

Figure 8-148 Second Switch Expanded

Description of Figure 8-148 follows
Description of "Figure 8-148 Second Switch Expanded"

8.12.1 Create the Switch

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag the Switch icon from the Component Palette and drop it below the "RequiresManualApproval" decide activity.

  3. Double-click the new switch activity and set its name to requiresApproval in the Switch dialog. Click OK.

  4. Expand the switch activity.

  5. Delete the <otherwise> box. For this switch, you only need to handle the case where an order requires manual approval.

8.12.2 Set the Condition for the <case>

  1. Double-click the title bar of the <case> box to display the Switch Case dialog.

  2. In the Switch Case dialog, click the XPath Expression Builder icon above the Expression box to display the Expression Builder dialog.

  3. In the Expression Builder dialog, select getVariableData in the Functions box.

    The Content Preview box should show bpws:getVariableData().

  4. Add the first parameter to the function: In the BPEL Variables box, select Variables > Process > Variables > requiresApproval.

    requiresApproval is a process variable that you defined in Section 8.11.4, "Create the "requiresApproval" Process Variable".

    The Content Preview box should show bpws:getVariableData('requiresApproval').

  5. Click Insert Into Expression. The Expression box should show the function with the one parameter.

  6. Append ='true' to the expression in the Expression box so that the expression looks like this:

    bpws:getVariableData('requiresApproval')='true'
    
    
  7. In the Expression box, wrap the string() function around the entire bpws:getVariableData function. The value in the Expression box should look like this:

    string(bpws:getVariableData('requiresApproval')) = 'true'
    
    

    Figure 8-149 Expression Builder Dialog Showing the Complete Expression for <case>

    Description of Figure 8-149 follows
    Description of "Figure 8-149 Expression Builder Dialog Showing the Complete Expression for <case>"

  8. Click OK in the Expression Builder dialog. The Switch Case dialog now contains the expression:

    Figure 8-150 Switch Case Dialog

    Description of Figure 8-150 follows
    Description of "Figure 8-150 Switch Case Dialog"

  9. Click OK in the Switch Case dialog.

  10. Select File > Save to save your work.

8.12.3 Create a Sequence in the <case> Branch

The <case> branch will contain two activities (a human task activity and a switch activity). This means that you need a sequence activity to be the container for these two activities.

Drag the Sequence icon from the Component Palette and drop it in the <case> box. The <case> box now looks like this:

Figure 8-151 Sequence Activity in the <case> Branch

Description of Figure 8-151 follows
Description of "Figure 8-151 Sequence Activity in the <case> Branch"

8.12.4 Create a Human Task

Create a human task activity in the <case> branch.

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag the Human Task icon from the Component Palette and drop it in the Sequence area in the <case> box. This displays the Add a Human Task dialog.

  3. In the Add a Human Task dialog, click the Create Task Definition icon (the second icon for the Task Definition field). This displays a different Add a Human Task dialog.

  4. In the second Add a Human Task dialog, enter ApproveOrder for the Human Task Name. This sets the location to: SOADEMO\SOAOrderBooking\bpel\ApproveOrder\ApproveOrder.task.

    Figure 8-152 Add a Human Task Dialog

    Description of Figure 8-152 follows
    Description of "Figure 8-152 Add a Human Task Dialog"

  5. Click OK. JDeveloper closes the Add a Human Task dialog and displays the ApproveOrder.task page.

  6. In the ApproveOrder.task page, you can leave the Title empty.

  7. For Parameters:

    1. Click the green + icon, which displays the Add Task Parameter dialog.

    2. In the Add Task Parameter dialog, select Element and click the flashlight icon, which displays the Type Chooser dialog. In the Type Chooser dialog, select Type Explorer > Project Schema Files > OrderBookingPO.xsd > PurchaseOrder.

      Figure 8-153 Type Chooser Dialog for ApproveOrder.task Parameter

      Description of Figure 8-153 follows
      Description of "Figure 8-153 Type Chooser Dialog for ApproveOrder.task Parameter"

      Click OK in the Type Chooser dialog. The Add Task Parameter dialog now looks like this:

      Figure 8-154 Add Task Parameter Dialog

      Description of Figure 8-154 follows
      Description of "Figure 8-154 Add Task Parameter Dialog"

    3. Click OK in the Add Task Parameter dialog.

  8. For Assignment and Routing Policy:

    1. Click the green + icon. This displays the Add Participant Type dialog.

      Figure 8-155 Add Participant Type Dialog

      Description of Figure 8-155 follows
      Description of "Figure 8-155 Add Participant Type Dialog"

    2. For Type, select Single Approver.

    3. For Label, enter Manager.

    4. Select By Name, and click the flashlight for Group Id(s) because you want to give the approve authority to a group. This displays the Identity Lookup dialog.

    5. In the Identity Lookup dialog, click Lookup. This should produce a list of group names in the Search Group box.

    6. Select Supervisor in the Search Group box and click Select. This moves the name to the Selected Group box.

      Figure 8-156 "Supervisor" Selected and Moved to the Selected Group Box

      Description of Figure 8-156 follows
      Description of "Figure 8-156 "Supervisor" Selected and Moved to the Selected Group Box"

    7. Click OK in the Identity Lookup dialog. "Supervisor" now appears in the Add Participant Type dialog (see Figure 8-155).

  9. Click OK in the Add Participant Type dialog.

    The ApproveOrder.task page now looks like this:

    Figure 8-157 ApproveOrder.task Page, Completed

    Description of Figure 8-157 follows
    Description of "Figure 8-157 ApproveOrder.task Page, Completed"

  10. Select File > Save to save ApproveOrder.task.

  11. Close ApproveOrder.task (select File > Close).

  12. Back on the SOAOrderBooking.bpel main page, double-click the "ApproveOrder_1" human task activity. This displays the Human Task dialog.

  13. For the Task Title field, enter Approve Order.

  14. The Task Parameters column is filled in with "PurchaseOrder", but the BPEL Variable column is blank. Click the flashlight icon in the BPEL Variable column.

  15. In the Task Parameters dialog, select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder.

    Figure 8-158 Task Parameters Dialog

    Description of Figure 8-158 follows
    Description of "Figure 8-158 Task Parameters Dialog"

    Click OK in the Task Parameters dialog.

  16. The Human Task dialog now looks like the following:

    Figure 8-159 Human Task Dialog, Completed

    Description of Figure 8-159 follows
    Description of "Figure 8-159 Human Task Dialog, Completed"

    Click OK in the Human Task dialog.

JDeveloper creates the SOADEMO\SOAOrderBooking\bpel\ApproveOrder directory, and creates these files in it:

  • ApproveOrder.task

  • ApproveOrder_payload.xsd

  • WorkflowTask.xsd

8.12.5 Create a Form for the Worklist Application

When a manager wants to see the orders that are waiting for approval, the manager logs into the Worklist application. You can access this application from the Start menu of the machine running Oracle Application Server: Start > Programs > Oracle - ORACLE_HOME_NAME > Oracle BPEL Process Manager > Worklist Application.

You need to create a form that the Worklist application can use. This form enables the Worklist application to display data specific to the SOA Order Booking application.

To create this form:

  1. In the Application Navigator, right-click the ApproveOrder folder (located under SOAOrderBooking > Integration Content) and select Auto Generate Simple Task Form.

  2. JDeveloper displays the payload-body.jsp file in the editor. You can close it without making any changes to it.

JDeveloper creates the following directory and files:

  • SOADEMO\SOAOrderBooking\bpel\ApproveOrder\ApproveOrder_Display.tform

  • SOADEMO\SOAOrderBooking\public_html\

8.12.6 Accept the Default Settings for the Remaining Human Task Activities

Expand the "ApproveOrder_1" human task activity to see the activities contained in this scope (see Figure 8-147). You can just accept the default settings for these activities.

8.13 Handle the Manager's Response ("requiresApproval" Switch)

JDeveloper created a switch for you automatically after the human task activity. This switch enables you to define the actions to take depending on whether the manager approved or rejected the order, or if the order has expired.

The switch handles these cases:

8.13.1 Handle the Reject Case

If the manager rejected the order, you want to perform these two activities:

  • set the status item to a string saying that the order has been rejected, and

  • create a throw activity

8.13.1.1 Set the Status of the Order (Assign Activity)

  1. Expand the switch.

  2. For <case Task outcome is REJECT>, delete the default "CopyPayloadFromTask" assign activity. There are now no activities for the REJECT case.

  3. In the Component Palette, select Process Activities from the dropdown.

  4. Drag the Assign activity icon from the Component Palette and drop it in the REJECT case.

  5. Double-click the new assign activity to display the Assign dialog.

  6. In the Assign dialog, click the Copy Operation tab.

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

  8. In the From side, set Type to Expression, and enter the following line in the Expression box:

    string('Order has been rejected by the manager')
    
    
  9. In the To side, set Type to Variable, and select Variables > Process > Variables > OrderBookingFault > payload > client:SOAOrderBookingProcessFault > client:status.

    Figure 8-160 Create Copy Operation Dialog for the REJECT Case

    Description of Figure 8-160 follows
    Description of "Figure 8-160 Create Copy Operation Dialog for the REJECT Case"

  10. Click OK in the Create Copy Operation dialog. You should see the copy operation in the Assign dialog.

  11. Click OK in the Assign dialog.

    Figure 8-161 Assign Dialog Showing Copy Operation for the REJECT Case

    Description of Figure 8-161 follows
    Description of "Figure 8-161 Assign Dialog Showing Copy Operation for the REJECT Case"

8.13.1.2 Create a Throw Activity

Create a throw activity to stop the flow from continuing.

  1. Drag the Throw icon from the Component Palette and drop it below the previous assign activity.

  2. Double-click the new throw activity to display the Throw dialog.

  3. In the Throw dialog:

    • Name: enter Throw_1 (keep the default name).

    • Namespace URI: enter http://www.globalcompany.com/ns/OrderBooking. You have to enter it manually.

    • Local Part: enter OrderBookingFault. You have to enter it manually.

    • Fault Variable: click the flashlight and select OrderBookingFault.

    Figure 8-162 Throw Dialog for the REJECT Case

    Description of Figure 8-162 follows
    Description of "Figure 8-162 Throw Dialog for the REJECT Case"

  4. Click OK in the Throw dialog.

8.13.2 Handle the Approve Case

In the Approve case, delete the default assign activity and create an empty activity by dragging the Empty icon from the Component Palette to the APPROVE case. You only need the empty activity because nothing needs to happen here. The flow just needs to continue to the next step.

8.13.3 Handle the Expired Case

You handle the Expired, Stale, Withdrawn, or Errored case in the same manner as for the Approve case, that is, delete the default assign activity and replace it with an empty activity. This is acceptable because in the SOA Order Booking application, orders do not expire and users will not encounter this case.

8.13.4 Accept the Default Settings for Each Case

JDeveloper also set the conditions for each branch in the switch. To see the conditions, double-click the titlebar on each branch. You do not need to make any changes to the conditions.

8.13.5 Minimize the "requiresApproval" Switch

Click the [-] icon on the "requiresApproval" switch to minimize it.

8.14 Choose a Supplier ("SelectSupplier" Scope)

This scope sends the order information to the two suppliers, Select Manufacturer and Rapid Service, and the suppliers return their bids for the orders. The scope then chooses the supplier that provided the lower bid.

Figure 8-163 shows the activities in the "SelectSupplier" scope at a high level. The scope uses a flow activity to send the order information to the two suppliers in parallel. The flow contains two scopes, one for each supplier. After the suppliers have returned their bids, a switch activity selects the lower bid.

Figure 8-163 Activities for the "SelectSupplier" Scope Shown at a High Level

Description of Figure 8-163 follows
Description of "Figure 8-163 Activities for the "SelectSupplier" Scope Shown at a High Level"

Figure 8-164 shows the activities in the flow, and also the switch activity after the flow.

The scope for Select Manufacturer includes a receive activity, which is not required for the scope for Rapid Service. This is because Select Manufacturer is invoked asynchronously. The receive activity is needed to receive the bid when Select Manufacturer returns it. Rapid Service is invoked synchronously; the invoke activity invokes the request and receives the response (that is, the bid value).

The switch activity has two branches: the <case> branch handles the case where SelectManufacturer returned the lower bid, and the <otherwise> branch handles the case where Rapid Service returned the lower bid.

Figure 8-164 "SelectSupplier" Scope Showing Flow and Switch Activities

Description of Figure 8-164 follows
Description of "Figure 8-164 "SelectSupplier" Scope Showing Flow and Switch Activities"

Before you can create the scope, you need to:

8.14.1 Create the "SelectManufacturer" Partner Link

  1. In the Component Palette, select Services from the dropdown.

  2. Drag the Partner Link icon from the Component Palette and drop it in a Services swimlane.

  3. In the Create Partner Link dialog:

    • Name: enter SelectService.

    • WSDL File: click the service explorer (flashlight) icon (the second icon from the left). This displays the Service Explorer dialog.

      In the Service Explorer dialog, select Service Explorer > BPEL Services > soaDemoIntgServer > processes > default > SelectManufacturer.

      soaDemoIntgServer refers to your connection to the Integration Server where you deployed Select Manufacturer.

      Figure 8-165 Service Explorer Dialog for the "SelectService" Partner Link

      Description of Figure 8-165 follows
      Description of "Figure 8-165 Service Explorer Dialog for the "SelectService" Partner Link"

      Click OK in the Service Explorer dialog.

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

    • Partner Role: select SelectServiceProvider.

    • My Role: select SelectServiceRequester.

    The Create Partner Link dialog should look like this:

    Figure 8-166 Create Partner Link Dialog for the "SelectService" Partner Link

    Description of Figure 8-166 follows
    Description of "Figure 8-166 Create Partner Link Dialog for the "SelectService" Partner Link"

  4. Click OK in the Create Partner Link dialog.

  5. Select File > Save to save your work.

8.14.2 Create the "RapidService" Partner Link

  1. Copy the following file from the soademo_101310_prod.zip file to the SOAOrderBooking\bpel directory.

    • RapidService.wsdl

    The WSDL file is located in the SOAOrderBooking\bpel directory in the soademo_101310_prod.zip file.

  2. Verify the URL in the RapidService.wsdl file.

    1. Select File > Open and open the RapidService.wsdl file.

    2. Click the Source tab at the bottom of the editor to view the lines in the file.

    3. The http://localhost:8888 reference in the file assumes that Oracle Application Server is running on the same machine as JDeveloper, and that Oracle Application Server is listening for requests on port 8888.

      If necessary, change localhost to the name of the machine running Oracle Application Server, and 8888 to the correct port used by your Oracle Application Server installation, for example: mypc.mydomain.com:8889.

    4. If you edited the file, save the file and close it.

  3. Drag the Partner Link icon from the Component Palette and drop it in a partner link area.

  4. In the Create Partner Link dialog:

    • Name: enter RapidService.

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

      Figure 8-167 Service Explorer Dialog for the "RapidService" Partner Link

      Description of Figure 8-167 follows
      Description of "Figure 8-167 Service Explorer Dialog for the "RapidService" Partner Link"

      Click OK in the Service Explorer.

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

    • Partner Role: select RapidQuote_Role.

    • My Role: leave it blank.

    The Create Partner Link dialog should look like this:

    Figure 8-168 Create Partner Link Dialog for RapidService

    Description of Figure 8-168 follows
    Description of "Figure 8-168 Create Partner Link Dialog for RapidService"

  5. Click OK in the Create Partner Link dialog.

  6. Select File > Save to save your work.

8.14.3 Create the "SelectSupplier" Scope

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag the Scope icon from the Component Palette and drop it below the "requiresApproval" switch activity.

  3. Double-click the new scope to display the Scope dialog.

  4. In the Scope dialog, in the General tab:

    • Name: enter SelectSupplier.

    • Variable Access Serializable: do not select.

  5. Click the Variables tab. You need to create two variables for this scope.

  6. In the Variables tab, click Create to create the first variable.

  7. In the Create Variable dialog:

    • Name: enter selectManufacturerResponse.

    • Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > SelectService > SelectManufacturer > Message Types > RequestQuote_processRequestQuoteResponse.

      Figure 8-169 Type Chooser Dialog for the "selectManufacturerResponse" Variable

      Description of Figure 8-169 follows
      Description of "Figure 8-169 Type Chooser Dialog for the "selectManufacturerResponse" Variable"

      Click OK in the Type Chooser.

  8. In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/selectservice}RequestQuote_processRequestQuoteResponse.

    Figure 8-170 Create Variable Dialog for the "selectManufacturerResponse" Variable

    Description of Figure 8-170 follows
    Description of "Figure 8-170 Create Variable Dialog for the "selectManufacturerResponse" Variable"

  9. Click OK in the Create Variable dialog.

  10. In the Variables tab, click Create again to create the second variable.

  11. In the Create Variable dialog:

    • Name: enter rapidManufacturerResponse.

    • Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > RapidService > RapidService.wsdl > Imported WSDL > RequestQuoteSoapHttpPort > Message Types > RequestQuotePortType_POItemsQuoteResponse.

      Figure 8-171 Type Chooser Dialog for the "rapidManufacturerResponse" Variable

      Description of Figure 8-171 follows
      Description of "Figure 8-171 Type Chooser Dialog for the "rapidManufacturerResponse" Variable"

      Click OK in the Type Chooser.

  12. In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/rapidservice}RequestQuotePortType_POItemsQuoteResponse.

    Figure 8-172 Create Variable Dialog for the "rapidManufacturerResponse" Variable

    Description of Figure 8-172 follows
    Description of "Figure 8-172 Create Variable Dialog for the "rapidManufacturerResponse" Variable"

  13. Click OK in the Create Variable dialog.

  14. The variables appear in the Variables tab of the Scope dialog.

    Figure 8-173 Scope Dialog for the "SelectSupplier" Scope

    Description of Figure 8-173 follows
    Description of "Figure 8-173 Scope Dialog for the "SelectSupplier" Scope"

    Click OK in the Scope dialog.

8.14.4 Create a Flow Activity

You use a flow activity in order to send out requests to more than one supplier at the same time. In the case of this application, you send out requests to two suppliers: Select Manufacturer and Rapid Service.

  1. Expand the new "SelectSupplier" scope.

  2. Drag the Flow icon from the Component Palette and drop it into the new "SelectSupplier" scope.

  3. Double-click the new flow instance and in the Flow dialog, set the name to CallManufacturers.

8.14.5 Set the Activities for Select Manufacturer

To get a quote from Select Manufacturer, you create these activities:

8.14.5.1 Create a Scope for SelectManufacturer

  1. Expand the "CallManufacturers" flow. The flow has two parallel areas where you can define activities.

    Figure 8-174 Flow Activity in the SOAOrderBooking.bpel Page

    Description of Figure 8-174 follows
    Description of "Figure 8-174 Flow Activity in the SOAOrderBooking.bpel Page"

  2. Drag the Scope icon from the Component Palette and drop it into the left side of the flow. The left side of the flow handles requests to and responses from Select Manufacturer.

  3. Double-click the new scope instance. This displays the Scope dialog.

  4. In the Scope dialog, in the General tab:

    • Name: enter GetSelectMfrQuote.

    • Variable Access Serializable: do not select.

  5. Click the Variables tab. You need to create a variable for this scope.

  6. In the Variables tab, click Create.

  7. In the Create Variable dialog:

    • Name: enter manufacturerRequest.

    • Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > SelectService > SelectManufacturer > Message Types > RequestQuote_processRequestQuote.

      Figure 8-175 Type Chooser Dialog for the "manufacturerRequest" Variable

      Description of Figure 8-175 follows
      Description of "Figure 8-175 Type Chooser Dialog for the "manufacturerRequest" Variable"

      Click OK in the Type Chooser.

  8. In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/selectservice}RequestQuote_processRequestQuote.

    Figure 8-176 Create Variable Dialog for the "manufacturerRequest" Variable

    Description of Figure 8-176 follows
    Description of "Figure 8-176 Create Variable Dialog for the "manufacturerRequest" Variable"

  9. Click OK in the Create Variable dialog.

  10. The manufacturerRequest variable appears in the Variables tab of the Scope dialog.

    Figure 8-177 Scope Dialog for the "GetSelectMfrQuote" Scope

    Description of Figure 8-177 follows
    Description of "Figure 8-177 Scope Dialog for the "GetSelectMfrQuote" Scope"

    Click OK in the Scope dialog.

8.14.5.2 Create a Transform Activity ("TransformSelectRequest" Transform Activity)

  1. Expand the "GetSelectMfrQuote" scope.

  2. Drag the Transform icon from the Component Palette and drop it in the "GetSelectMfrQuote" scope.

  3. Double-click the transform activity to display the Transform dialog.

  4. In the General tab, set the name to TransformSelectRequest.

  5. In the Transformation tab, set the Source Variable to inputVariable, and the Source Part to payload.

    Set the Target Variable to manufacturerRequest and the Target Part to parameters.

  6. Set the Mapper File to SelectTransformation.xsl. This file does not exist yet; you will use the Data Mapper to generate it.

  7. Click the Create Mapping icon (second icon from the left). This displays the Data Mapper, which you will use to generate the SelectTransformation.xsl file.

  8. In the Data Mapper, on the Source (left) side, expand po:PurchaseOrder > po:OrderItems > po:Item.

  9. On the Target (right) side, expand tns:param0.

  10. Drag po:ProductName to tns:itemId.

  11. Drag po:Quantity to tns:quantity. The Data Mapper should look like the following:

    Figure 8-178 Data Mapper for Select Manufacturer (Not Complete Yet)

    Description of Figure 8-178 follows
    Description of "Figure 8-178 Data Mapper for Select Manufacturer (Not Complete Yet)"

  12. In the Component Palette for the Data Mapper, select XSLT Constructs from the dropdown.

  13. Drag the for-each icon from the Component Palette and drop it on tns:param0 on the target side. You want the for-each item to appear between tns:processRequestQuoteElement and tns:param0.

  14. Drag po:Item to the for-each item on the target side. The Data Mapper should now look like this:

    Figure 8-179 Data Mapper for Select Manufacturer

    Description of Figure 8-179 follows
    Description of "Figure 8-179 Data Mapper for Select Manufacturer"

  15. Select File > Save to save SelectTransformation.xsl. This file is created in the SOAOrderBooking\bpel directory.

  16. Select File > Close to close the Data Mapper for SelectTransformation.xsl.

  17. Select File > Save to save SOAOrderBooking.bpel.

8.14.5.3 Create an Invoke Activity

This invoke activity invokes the SelectManufacturer partner link.

  1. Drag the Invoke icon from the Component Palette and drop it below the "TransformSelectRequest" transform activity.

  2. Do one of the following to display the Invoke dialog:

    • Drag one of the arrows on the side of the new invoke activity and drop it on the "SelectService" partner link. This associates the invoke activity with the partner link.

    • Double-click the new invoke activity.

  3. In the Invoke dialog, set the name of the invoke activity to InvokeSelectManufacturer.

  4. If the Partner Link field is not set to SelectService, click the flashlight. In the Partner Link Chooser, select SelectService and click OK.

    Figure 8-180 Partner Link Chooser Dialog for the "InvokeSelectManufacturer" Invoke Activity

    Description of Figure 8-180 follows
    Description of "Figure 8-180 Partner Link Chooser Dialog for the "InvokeSelectManufacturer" Invoke Activity"

  5. For Operation, select processRequestQuote. This should be filled in automatically for you.

  6. For Input Variable, click the Browse Variable icon, which displays the Variable Chooser dialog. In the dialog, select Variables > Process > Scope - SelectSupplier > Scope - GetSelectMfrQuote > Variables > manufacturerRequest.

    Figure 8-181 Variable Chooser for the Input Variable for the "InvokeSelectManufacturer" Invoke Activity

    Description of Figure 8-181 follows
    Description of "Figure 8-181 Variable Chooser for the Input Variable for the "InvokeSelectManufacturer" Invoke Activity"

    Click OK in the Variable Chooser.

  7. The Invoke dialog looks like the following:

    Figure 8-182 Invoke Dialog for the "InvokeSelectManufacturer" Invoke Activity

    Description of Figure 8-182 follows
    Description of "Figure 8-182 Invoke Dialog for the "InvokeSelectManufacturer" Invoke Activity"

    Click OK in the Invoke dialog.

8.14.5.4 Create a Receive Activity

This receive activity receives the quote from the Select Manufacturer.

  1. Drag the Receive icon from the Component Palette and drop it below the "InvokeSelectManufacturer" activity.

  2. Do one of the following to display the Receive dialog:

    • Drag one of the arrows on the side of the new receive activity and drop it on the "SelectService" partner link. This associates the receive activity with the partner link.

    • Double-click the new receive activity.

  3. For Name, set it to ReceiveSelectManufacturer.

  4. Partner Link should be set to SelectService. If not, click the flashlight icon, which displays the Partner Link Chooser. Select SelectService and click OK.

    Figure 8-183 Partner Link Chooser Dialog for the "ReceiveSelectManufacturer" Receive Activity

    Description of Figure 8-183 follows
    Description of "Figure 8-183 Partner Link Chooser Dialog for the "ReceiveSelectManufacturer" Receive Activity"

  5. For Operation, set it to processRequestQuoteResponse. This should be filled in automatically for you.

  6. For Variable, click the Browse Variable icon, which displays the Variable Chooser. Select Variables > Process > Scope - SelectSupplier > Variables > selectManufacturerResponse.

    Figure 8-184 Variable Chooser Dialog for the "ReceiveSelectManufacturer" Receive Activity

    Description of Figure 8-184 follows
    Description of "Figure 8-184 Variable Chooser Dialog for the "ReceiveSelectManufacturer" Receive Activity"

    Click OK in the Variable Chooser.

  7. For the Create Instance option, do not select it.

  8. The Receive dialog looks like Figure 8-185. Click OK.

    Figure 8-185 Receive Dialog

    Description of Figure 8-185 follows
    Description of "Figure 8-185 Receive Dialog"

  9. Select File > Save to save your work.

8.14.6 Set the Activities for Rapid Manufacturer

To get a quote from Rapid Manufacturer, you create these activities:

8.14.6.1 Create a Scope for Rapid Manufacturer

You use the right side of the flow activity to define the activities for Rapid Manufacturer.

  1. Drag the Scope icon from the Component Palette and drop it in the right side of the flow. You will define activities in this scope to handle requests to and responses from Rapid Manufacturer.

  2. Double-click the new scope activity to display the Scope dialog.

  3. In the General tab, set the name of the scope to CallRapidManufacturer.

    Do not select Variable Access Serializable.

  4. In the Variables tab, click Create, which displays the Create Variable dialog.

  5. In the Create Variable dialog, enter manufacturerRequest as the variable name.

  6. Select Message Type and click the flashlight, which displays the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > RapidService > RapidService.wsdl > Imported WSDL > RequestQuoteSoapHttpPort > Message Types > RequestQuotePortType_POItemsQuote.

    Figure 8-186 Type Chooser Dialog for the "CallRapidManufacturer" Scope

    Description of Figure 8-186 follows
    Description of "Figure 8-186 Type Chooser Dialog for the "CallRapidManufacturer" Scope"

    Click OK in the Type Chooser.

  7. In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/rapidservice}RequestQuotePortType_POItemsQuote.

    Figure 8-187 Create Variable Dialog for the "CallRapidManufacturer" Scope

    Description of Figure 8-187 follows
    Description of "Figure 8-187 Create Variable Dialog for the "CallRapidManufacturer" Scope"

  8. Click OK in the Create Variable dialog.

  9. The manufacturerRequest variable appears in the Variables tab of the Scope dialog.

    Figure 8-188 Scope Dialog for the "CallRapidManufacturer" Scope

    Description of Figure 8-188 follows
    Description of "Figure 8-188 Scope Dialog for the "CallRapidManufacturer" Scope"

    Click OK in the Scope dialog.

8.14.6.2 Create a Transform Activity ("TransformRapidRequest" Transform Activity)

  1. Expand the "CallRapidManufacturer" scope.

  2. Drag the Transform icon from the Component Palette and drop it in the "CallRapidManufacturer" scope.

  3. Double-click the transform activity to display the Transform dialog.

  4. In the General tab, set the name to TransformRapidRequest.

  5. In the Transformation tab, set the Source Variable to inputVariable, and the Source Part to payload.

    Set the Target Variable to manufacturerRequest and the Target Part to parameters.

  6. Set the Mapper File to RapidTransformation.xsl. This file does not exist yet; you will use the Data Mapper to generate it.

  7. Click the Create Mapping icon (second icon from the left). This displays the Data Mapper, which you will use to generate the RapidTransformation.xsl file.

  8. In the Data Mapper, on the Source (left) side, expand po:PurchaseOrder > po:OrderItems > po:Item.

  9. On the Target (right) side, expand tns:items.

  10. Drag po:ProductName to tns:itemId.

  11. Drag po:Quantity to tns:quantity. The Data Mapper should look like the following:

    Figure 8-189 Data Mapper for Rapid Manufacturer (Not Complete Yet)

    Description of Figure 8-189 follows
    Description of "Figure 8-189 Data Mapper for Rapid Manufacturer (Not Complete Yet)"

  12. In the Component Palette for the Data Mapper, select XSLT Constructs from the dropdown.

  13. Drag the for-each icon from the Component Palette and drop it on tns:items on the target side. You want the for-each item to appear between tns:POItemsQuote and tns:items.

  14. Drag po:Item to the for-each item on the target side. The Data Mapper should now look like this:

    Figure 8-190 Data Mapper for Rapid Manufacturer

    Description of Figure 8-190 follows
    Description of "Figure 8-190 Data Mapper for Rapid Manufacturer"

  15. Select File > Save to save RapidTransformation.xsl. This file is created in the SOAOrderBooking\bpel directory.

  16. Select File > Close to close the Data Mapper for RapidTransformation.xsl.

  17. Select File > Save to save SOAOrderBooking.bpel.

8.14.6.3 Create an Invoke Activity

This invoke activity invokes the RapidService partner link.

  1. Drag the Invoke icon from the Component Palette and drop it below the "TransformRapidRequest" transform activity.

  2. Do one of the following to display the Invoke dialog:

    • Drag one of the arrows on the side of the new invoke activity and drop it on the "RapidService" partner link. This associates the invoke activity with the partner link.

    • Double-click the new invoke activity.

  3. In the Invoke dialog, set the name of the invoke activity to InvokeRapidManufacturer.

  4. The Partner Link field should be set to RapidService. If not, click the flashlight and in the Partner Link Chooser, select RapidService and click OK.

    Figure 8-191 Partner Link Chooser Dialog for the "InvokeRapidManufacturer" Activity

    Description of Figure 8-191 follows
    Description of "Figure 8-191 Partner Link Chooser Dialog for the "InvokeRapidManufacturer" Activity"

  5. For Operation, select POItemsQuote. This should be filled in automatically for you.

  6. For Input Variable, click the Browse Variable icon, which displays the Variable Chooser dialog. In the dialog, select Variables > Process > Scope - SelectSupplier > Scope - CallRapidManufacturer > Variables > manufacturerRequest.

    Figure 8-192 Variable Chooser Dialog for the Input Variable for the "InvokeRapidManufacturer" Activity

    Description of Figure 8-192 follows
    Description of "Figure 8-192 Variable Chooser Dialog for the Input Variable for the "InvokeRapidManufacturer" Activity"

    Click OK in the Variable Chooser.

  7. For Output Variable, click the Browse Variable icon, which displays the Variable Chooser dialog. In the dialog, select Variables > Process > Scope - SelectSupplier > Variables > rapidManufacturerResponse.

    Figure 8-193 Variable Chooser Dialog for the Output Variable for the "InvokeRapidManufacturer" Activity

    Description of Figure 8-193 follows
    Description of "Figure 8-193 Variable Chooser Dialog for the Output Variable for the "InvokeRapidManufacturer" Activity"

    Click OK in the Variable Chooser.

  8. The Invoke dialog looks like the following:

    Figure 8-194 Invoke Dialog for the "InvokeRapidManufacturer" Activity

    Description of Figure 8-194 follows
    Description of "Figure 8-194 Invoke Dialog for the "InvokeRapidManufacturer" Activity"

    Click OK in the Invoke dialog.

  9. Select File > Save to save your work.

8.14.7 Create a Switch to Pick the Lower-Priced Quote

Create a switch so that you can pick the manufacturer that responded with the lower-priced quote.

8.14.7.1 Create the Switch

  1. Minimize the flow activity in the "SelectSupplier" scope. (But do not minimize the scope.) The page should look like this:

    Figure 8-195 Minimize Only the Flow Activity

    Description of Figure 8-195 follows
    Description of "Figure 8-195 Minimize Only the Flow Activity"

  2. Drag the Switch icon from the Component Palette and drop it below the "CallManufacturers" flow activity, but still within the "SelectSupplier" scope.

  3. Double-click the switch to display the Switch dialog.

  4. In the Switch dialog, set the name to SelectByPrice and click OK.

8.14.7.2 Set the Condition for the Switch

For this switch activity, you just need to specify the condition for the <case> branch. For the <otherwise> branch, you do not have to set a condition. If the condition in the <case> branch is not met, then the activities in the <otherwise> branch are executed.

  1. Expand the switch activity.

  2. Double-click the titlebar of the <case> box to display the Switch Case dialog.

  3. The <case> branch handles the case where Select Manufacturer returns a lower price than Rapid Service. In the Expression area, enter the following line:

    number(bpws:getVariableData('selectManufacturerResponse','parameters',
    '/ns15:processRequestQuoteResponseElement/ns15:return/ns15:supplierPrice')) <
    number(bpws:getVariableData('rapidManufacturerResponse','parameters',
    '/ns16:POItemsQuoteResponse/ns30:return/ns30:supplierPrice'))
    
    

    You may need to replace the prefixes for the namespaces, as follows:

    • ns15 is the prefix for http://www.globalcompany.com/ns/selectservice.

    • ns16 is the prefix for http://www.globalcompany.com/ns/rapidservice.

    You can also use the Expression Builder to create the condition:

    1. In the Switch Case dialog, click the XPath Expression Builder icon above the Expression box.

    2. In the Expression Builder dialog, select Variables > Process > Scope - SelectSupplier > Variables > selectManufacturerResponse > parameters > ns15:processRequestQuoteResponseElement > ns15:return > ns15:supplierPrice.

      The Content Preview box in the dialog shows the bpws:getVariableData function with parameters to get the supplierPrice data.

    3. Click Insert Into Expression.

      The Expression Builder dialog should now look like this:

      Figure 8-196 Expression Builder Dialog

      Description of Figure 8-196 follows
      Description of "Figure 8-196 Expression Builder Dialog"

    4. In the Expression Builder dialog, in the Expression box, type a < (less than) character. Figure 8-197 shows the Expression box in the Expression Builder dialog.

      Figure 8-197 Expression Builder Showing the First Half of the Condition

      Description of Figure 8-197 follows
      Description of "Figure 8-197 Expression Builder Showing the First Half of the Condition"

    5. In the Expression Builder dialog, select Variables > Process > Scope - SelectSupplier > Variables > rapidManufacturerResponse > parameters > ns16:POItemsQuoteResponse > ns16:return > ns16:supplierPrice.

    6. Click Insert Into Expression.

      The Expression Builder dialog should now look like this:

      Figure 8-198 Expression Builder Dialog Showing Both Parts of the Condition

      Description of Figure 8-198 follows
      Description of "Figure 8-198 Expression Builder Dialog Showing Both Parts of the Condition"

    7. Wrap each bpws:getVariableData function with the number function, so that the expression looks like this:

      number(bpws:getVariableData(....)) < number(bpws:getVariableData(....))
      
      

      You have to manually type in number( before the bpws:getVariableData function and the closing parenthesis ) after the function.

      The final expression should look like this:

      Figure 8-199 Expression Builder Dialog Showing the Final Expression

      Description of Figure 8-199 follows
      Description of "Figure 8-199 Expression Builder Dialog Showing the Final Expression"

    8. Click OK in the Expression Builder dialog.

    Figure 8-200 Switch Case Dialog for <case>

    Description of Figure 8-200 follows
    Description of "Figure 8-200 Switch Case Dialog for <case>"

  4. Click OK in the Switch Case dialog.

8.14.7.3 Set the Activities for Select Manufacturer

Define the activities for Select Manufacturer if it bid the lower quote. In this case, assign the bid value to the supplierPrice field of inputVariable.

  1. Drag the Assign activity icon from the Component Palette and drop it in the <case> box.

  2. Double-click the new assign activity to display the Assign dialog.

  3. In the Assign dialog, click the General tab, and set the Name to AssignSelectManufacturer.

  4. Still in the Assign dialog, click the Copy Operation tab. You will create two copy operations.

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

    • In the From side, set Type to Variable, and select Variables > Process > Scope - SelectSupplier > Variables > selectManufacturerResponse > parameters > ns15:processRequestQuoteResponseElement > ns15:return > ns15:supplierPrice.

    • In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:SupplierInfo > ns1:SupplierPrice.

    Figure 8-201 Create Copy Operation Dialog for the "AssignSelectManufacturer" Activity, First Copy Operation

    Description of Figure 8-201 follows
    Description of "Figure 8-201 Create Copy Operation Dialog for the "AssignSelectManufacturer" Activity, First Copy Operation"

    Click OK in the Create Copy Operation dialog.

  6. Select Copy Operation from the Create dropdown again to create the second copy operation. This displays the Create Copy Operation dialog.

    • In the From side, set Type to Variable, and select Variables > Process > Scope - SelectSupplier > Variables > selectManufacturerResponse > parameters > ns15:processRequestQuoteResponseElement > ns15:return > ns15:supplierName.

    • In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:SupplierInfo > ns1:SupplierName.

    Figure 8-202 Create Copy Operation Dialog for the "AssignSelectManufacturer" Activity, Second Copy Operation

    Description of Figure 8-202 follows
    Description of "Figure 8-202 Create Copy Operation Dialog for the "AssignSelectManufacturer" Activity, Second Copy Operation"

    Click OK in the Create Copy Operation dialog.

  7. You should see two copy operations in the Assign dialog. Click OK.

    Figure 8-203 Assign Dialog for the "AssignSelectManufacturer" Activity

    Description of Figure 8-203 follows
    Description of "Figure 8-203 Assign Dialog for the "AssignSelectManufacturer" Activity"

8.14.7.4 Set the Activities for Rapid Distributor

Define the activities for Rapid Manufacturer if it bid the lower quote. In this case, assign the bid value to the supplierPrice field of inputVariable.

  1. Drag the Assign activity icon from the Component Palette and drop it in the <otherwise> box.

  2. Double-click the new assign activity to display the Assign dialog.

  3. In the Assign dialog, click the General tab, and set the Name to AssignRapidManufacturer.

  4. Still in the Assign dialog, click the Copy Operation tab. You will create two copy operations.

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

    • In the From side, set Type to Variable, and select Variables > Process > Scope - SelectSupplier > Variables > rapidManufacturerResponse > parameters > ns16:POItemsQuoteResponse > ns16:return > ns16:supplierPrice.

    • In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:SupplierInfo > ns1:SupplierPrice.

    Figure 8-204 Create Copy Operation Dialog for the "AssignRapidManufacturer" Activity, First Copy Operation

    Description of Figure 8-204 follows
    Description of "Figure 8-204 Create Copy Operation Dialog for the "AssignRapidManufacturer" Activity, First Copy Operation"

    Click OK in the Create Copy Operation dialog.

  6. Select Copy Operation from the Create dropdown again to create the second copy operation. This displays the Create Copy Operation dialog.

    • In the From side, set Type to Variable, and select Variables > Process > Scope - SelectSupplier > Variables > rapidManufacturerResponse > parameters > ns16:POItemsQuoteResponse > ns16:return > ns16:supplierName.

    • In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:SupplierInfo > ns1:SupplierName.

    Figure 8-205 Create Copy Operation Dialog for the "AssignRapidManufacturer" Activity, Second Copy Operation

    Description of Figure 8-205 follows
    Description of "Figure 8-205 Create Copy Operation Dialog for the "AssignRapidManufacturer" Activity, Second Copy Operation"

    Click OK in the Create Copy Operation dialog.

  7. You should see two copy operations in the Assign dialog. Click OK.

    Figure 8-206 Assign Dialog for the "AssignRapidManufacturer" Activity

    Description of Figure 8-206 follows
    Description of "Figure 8-206 Assign Dialog for the "AssignRapidManufacturer" Activity"

  8. Select File > Save to save your work.

8.14.8 Minimize the "SelectSupplier" Scope

Click the [-] icon on the "SelectSupplier" scope to minimize it.

 

8.15 Determine the Shipping Method ("PostFulfillmentReq" Scope)

This scope invokes the FulfillmentESB project, which determines how an order is to be shipped. For orders $500 and over, Fedex is the shipment method. For orders less than $500, USPS is the shipment method. These rules are defined in the FulfillmentESB project, described in Chapter 4, "Creating the FulfillmentESB Project".

Before you can create the "PostFulfillmentReq" scope, the "FulfillmentESB" project must be registered with Oracle Application Server.

Figure 8-207 shows the activities in the "PostFulfillmentReq" scope.

Figure 8-207 Activities in the "PostFulfillmentReq" Scope

Description of Figure 8-207 follows
Description of "Figure 8-207 Activities in the "PostFulfillmentReq" Scope"

8.15.1 Create the "OrderFulfillment" Partner Link

  1. In the Component Palette, select Services from the dropdown.

  2. Drag the Partner Link icon from the Component Palette and drop it in a Services swimlane. This displays the Create Partner Link dialog.

  3. For Name, enter OrderFulfillment.

  4. For WSDL File, click the Service Explorer icon (second icon from the left) to display the Service Explorer dialog. In the Service Explorer dialog, select Service Explorer > Registered ESB Services > soademoIntegServer > Fulfillment > OrderFulfillment. soademoIntegServer refers to the name of the Integration Server connection.

    Figure 8-208 Service Explorer for the "OrderFulfillment" Partner Link

    Description of Figure 8-208 follows
    Description of "Figure 8-208 Service Explorer for the "OrderFulfillment" Partner Link"

    Click OK in the Service Explorer.

  5. Back in the Create Partner Link dialog, if you get a java.net.UnknownHostException error:

    • Check that the proxy settings are set correctly. To view the proxy settings in JDeveloper, select Tools > Preferences. In the Preferences dialog, select Web Browser and Proxy on the left side.

    • If the proxy settings are correct, replace the IP address in the URL with the hostname. For example:

      http://pc1.mydomain.com:8888/esb/wsil/Fulfillment/OrderFulfillment?wsdl

      Press the Tab key after you have entered the hostname.

  6. For Partner Link Type, select execute_pptLT. This should be filled in for you automatically.

  7. For Partner Role, select execute_pptProvider.

  8. For My Role, leave blank.

    The Create Partner Link dialog should look like this:

    Figure 8-209 Create Partner Link Dialog for the "OrderFulfillment" Partner Link

    Description of Figure 8-209 follows
    Description of "Figure 8-209 Create Partner Link Dialog for the "OrderFulfillment" Partner Link"

  9. Click OK in the Create Partner Link dialog.

8.15.2 Create the "PostFulfillmentReq" Scope

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag the Scope icon from the Component Palette and drop it below the "SelectSupplier" scope.

  3. Double-click the new scope to display the Scope dialog.

  4. In the General tab:

    • Name: enter PostFulfillmentReq.

    • Variable Access Serializable: do not select.

  5. Click the Variables tab. You need to create one variable for this scope.

  6. In the Variables tab, click Create.

  7. In the Create Variable dialog:

    • Name: enter orderFulfillmentRequest.

    • Select Message Type and click the flashlight icon to display the Type Chooser.

      In the Type Chooser, select Type Explorer > Message Types > Partner Links > OrderFulfillment > Imported WSDL > Fulfillment_OrderFulfillment.wsdl > Message Types > PurchaseOrder_request.

      Figure 8-210 Type Chooser Dialog for the "PostFulfillmentReq" Scope

      Description of Figure 8-210 follows
      Description of "Figure 8-210 Type Chooser Dialog for the "PostFulfillmentReq" Scope"

      Click OK in the Type Chooser.

  8. In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/Fulfillment}PurchaseOrder_request.

    Figure 8-211 Create Variable Dialog for the "PostFulfillmentReq" Scope

    Description of Figure 8-211 follows
    Description of "Figure 8-211 Create Variable Dialog for the "PostFulfillmentReq" Scope"

  9. Click OK in the Create Variable dialog.

  10. The orderFulfillmentRequest variable appears in the Variables tab of the Scope dialog.

    Figure 8-212 Scope Dialog for the "PostFulfillmentReq" Scope

    Description of Figure 8-212 follows
    Description of "Figure 8-212 Scope Dialog for the "PostFulfillmentReq" Scope"

    Click OK in the Scope dialog.

  11. Select File > Save to save your work.

8.15.3 Copy Order Information to Scope Variable ("initializeRequest" Assign Activity)

  1. Expand the "PostFulfillmentReq" scope.

  2. Drag the Assign activity icon from the Component Palette and drop it in the "PostFulfillmentReq" scope.

  3. Double-click the new assign activity to display the Assign dialog.

  4. In the Assign dialog, click the General tab, and set the Name to initializeRequest.

  5. Still in the Assign dialog, click the Copy Operation tab. You will create a copy operation.

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

    • In the From side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder.

    Figure 8-213 Create Copy Operation Dialog for the "initializeRequest" Activity

    Description of Figure 8-213 follows
    Description of "Figure 8-213 Create Copy Operation Dialog for the "initializeRequest" Activity"

    Click OK in the Create Copy Operation dialog.

  7. You should see the copy operation in the Assign dialog. Click OK.

    Figure 8-214 Assign Dialog for the "initializeRequest" Activity

    Description of Figure 8-214 follows
    Description of "Figure 8-214 Assign Dialog for the "initializeRequest" Activity"

8.15.4 Invoke OrderFulfillmentESB ("PostFulfillmentReq" Invoke Activity)

  1. Drag the Invoke icon from the Component Palette and drop it below the "initializeRequest" assign activity.

  2. Do one of the following to display the Invoke dialog:

    • Drag one of the arrows on the side of the new invoke activity and drop it on the "OrderFulfillment" partner link. This associates the invoke activity with the partner link.

    • Double-click the new invoke activity.

  3. In the Invoke dialog, set these values:

    The Invoke dialog should look like this:

    Figure 8-217 Invoke Dialog for the "PostFulfillmentReq" Invoke Activity

    Description of Figure 8-217 follows
    Description of "Figure 8-217 Invoke Dialog for the "PostFulfillmentReq" Invoke Activity"

  4. Click OK in the Invoke dialog.

  5. Select File > Save to save your work.

8.15.5 Create a Catch-All Branch for the Scope

Create a catch-all branch to catch all exceptions.

  1. Click the "Add CatchAll Branch" icon on the side of the "PostFulfillmentReq" scope.

    Figure 8-218 CatchAll Icon on the Side of the "PostFulfillmentReq" Scope

    Description of Figure 8-218 follows
    Description of "Figure 8-218 CatchAll Icon on the Side of the "PostFulfillmentReq" Scope"

    This displays a catchall branch off the side of the scope.

    Figure 8-219 Catchall Branch off the Side of the "PostFulfillmentReq" Scope

    Description of Figure 8-219 follows
    Description of "Figure 8-219 Catchall Branch off the Side of the "PostFulfillmentReq" Scope"

  2. Expand the catch-all branch.

  3. Drag the Empty icon from the Component Palette and drop it in the catchall branch. The catch just catches the exceptions without processing them.

  4. Select File > Save to save your work.

8.15.6 Minimize the "PostFulfillmentReq" Scope

Click the [-] on the "PostFulfillmentReq" scope to minimize it.

 

8.16 Set the Order Status to "Completed" ("SetFinalOrderStatus" Scope)

This scope uses a database adapter to update the order status in the database.

Figure 8-220 shows the activities in the scope.

Figure 8-220 Activities in the "SetFinalOrderStatus" Scope

Description of Figure 8-220 follows
Description of "Figure 8-220 Activities in the "SetFinalOrderStatus" Scope"

8.16.1 Create the "OrderStatus" Database Adapter

  1. In the Component Palette, select Services from the dropdown.

  2. Drag the Database Adapter icon from the Component Palette and drop it in a Services swimlane. This starts the Adapter Configuration Wizard. Click Next to start.

  3. In Step 1, Service Name, set the Service Name to OrderStatus. Leave Description blank.

    Figure 8-221 Adapter Configuration Wizard: Step 1, Service Name

    Description of Figure 8-221 follows
    Description of "Figure 8-221 Adapter Configuration Wizard: Step 1, Service Name"

    Click Next.

  4. In Step 2, Service Connection, for Connection, select the name of the database connection. The JNDI Name should be set automatically to eis/DB/soademo.

    Figure 8-222 Adapter Configuration WIzard: Step 2, Service Connection

    Description of Figure 8-222 follows
    Description of "Figure 8-222 Adapter Configuration WIzard: Step 2, Service Connection"

    Click Next.

  5. In Step 3, Operation Type, select Perform an Operation on a Table and select Update Only.

    Figure 8-223 Adapter Configuration WIzard: Step 3, Operation Type

    Description of Figure 8-223 follows
    Description of "Figure 8-223 Adapter Configuration WIzard: Step 3, Operation Type"

    Click Next.

  6. In Select Table, click Import Tables. This displays the Import Tables dialog.

  7. In the Import Tables dialog:

    • Schema: select SOADEMO.

    • Name Filter: enter %.

    Click Query.

    Select the ORDERS table on the left side and click the right arrow to move it to the Selected box.

    Figure 8-224 Adapter Configuration WIzard: Import Tables

    Description of Figure 8-224 follows
    Description of "Figure 8-224 Adapter Configuration WIzard: Import Tables"

    Click OK in the Import Tables dialog.

  8. Back in the Select Table page, select SOADEMO.ORDERS.

    Figure 8-225 Adapter Configuration WIzard: Step 4, Select Table

    Description of Figure 8-225 follows
    Description of "Figure 8-225 Adapter Configuration WIzard: Step 4, Select Table"

    Click Finish to accept the defaults for the remaining screens.

    The wizard creates the following files:

    • SOAOrderBooking\bpel\OrderStatus.wsdl

    • SOAOrderBooking\bpel\OrderStatus_table.xsd

    • SOAOrderBooking\bpel\OrderStatus_toplink_mappings.xml

    • SOAOrderBooking\src\OrderStatus\Orders.java

    • SOAOrderBooking\toplink\OrderStatus\OrderStatus.mwp

  9. Oracle JDeveloper now displays the Partner Link dialog with some fields already filled in for you:

    Name: OrderStatus

    WSDL File: SOAOrderBooking/bpel/OrderStatus.wsdl

    Partner Link Type: OrderStatus_plt

    Partner Role: OrderStatus_role

    Figure 8-226 Create Partner Link Dialog for the "OrderStatus" Database Adapter

    Description of Figure 8-226 follows
    Description of "Figure 8-226 Create Partner Link Dialog for the "OrderStatus" Database Adapter"

    Click OK.

  10. Select File > Save to save your work.

8.16.2 Create the "SetFinalOrderStatus" Scope

  1. In the Component Palette, select Process Activities from the dropdown.

  2. Drag the Scope icon from the Component Palette and drop it below the "PostFulfillmentReq" scope.

  3. Double-click the new scope to display the Scope dialog.

  4. In the General tab:

    • Name: enter SetFinalOrderStatus.

    • Variable Access Serializable: do not select.

  5. Click the Variables tab. You need to create one variable for this scope.

  6. In the Variables tab, click Create.

  7. In the Create Variable dialog:

  8. In the Create Variable dialog, the Message Type is set to {http://xmlns.oracle.com/pcbpel/adapter/db/OrderStatus/}OrdersCollection_msg.

    Figure 8-228 Create Variable Dialog for the "orderStatusRequest" Variable in the "SetFinalOrderStatus" Scope

    Description of Figure 8-228 follows
    Description of "Figure 8-228 Create Variable Dialog for the "orderStatusRequest" Variable in the "SetFinalOrderStatus" Scope"

  9. Click OK in the Create Variable dialog.

  10. The orderStatusRequest variable appears in the Variables tab of the Scope dialog.

    Figure 8-229 Scope Dialog for the "SetFinalOrderStatus" Scope

    Description of Figure 8-229 follows
    Description of "Figure 8-229 Scope Dialog for the "SetFinalOrderStatus" Scope"

    Click OK in the Scope dialog.

  11. Select File > Save to save your work.

8.16.3 Prepare the Order ID and Status ("AssignOrderStatus" Assign Activity)

  1. Expand the "SetFinalOrderStatus" scope.

  2. Drag the Assign activity icon from the Component Palette and drop it in the "SetFinalOrderStatus" scope.

  3. Double-click the new assign activity to display the Assign dialog.

  4. In the Assign dialog, click the General tab, and set the Name to AssignOrderStatus.

  5. Still in the Assign dialog, click the Copy Operation tab. You will create two copy operations.

  6. Create the first copy operation: Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.

    • In the From side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:ID.

    • In the To side, set Type to Variable, and select Variables > Process > Scope - SetFinalOrderStatus > Variables > orderStatusRequest > OrdersCollection > ns19:OrdersCollection > ns19:Orders > ns19:ordid.

    Figure 8-230 Create Copy Operation Dialog for the "AssignOrderStatus" Activity, First Copy Operation

    Description of Figure 8-230 follows
    Description of "Figure 8-230 Create Copy Operation Dialog for the "AssignOrderStatus" Activity, First Copy Operation"

    Click OK in the Create Copy Operation dialog.

  7. Create the second copy operation: Select Copy Operation from the Create dropdown again. This displays the Create Copy Operation dialog.

    • In the From side, set Type to Expression, and enter the following line in the Expression box:

      string('completed')

    • In the To side, set Type to Variable, and select Variables > Process > Scope - SetFinalOrderStatus > Variables > orderStatusRequest > OrdersCollection > ns19:OrdersCollection > ns19:Orders > ns19:status.

    Figure 8-231 Create Copy Operation Dialog for the "AssignOrderStatus" Activity, Second Copy Operation

    Description of Figure 8-231 follows
    Description of "Figure 8-231 Create Copy Operation Dialog for the "AssignOrderStatus" Activity, Second Copy Operation"

    Click OK in the Create Copy Operation dialog.

  8. You should see the copy operations in the Assign dialog. Click OK.

    Figure 8-232 Assign Dialog for the "AssignOrderStatus" Activity

    Description of Figure 8-232 follows
    Description of "Figure 8-232 Assign Dialog for the "AssignOrderStatus" Activity"

8.16.4 Update the Order Status in the Database ("UpdateOrderStatus" Invoke Activity)

Create the "UpdateOrderStatus" invoke activity to update the order status in the ORDERS table in the database.

  1. Drag the Invoke icon from the Component Palette and drop it below the "AssignOrderStatus" assign activity.

  2. Do one of the following to display the Invoke dialog:

    • Drag one of the arrows on the side of the new invoke activity and drop it on the "OrderStatus" database adapter. This associates the invoke activity with the database adapter.

    • Double-click the new invoke activity.

  3. In the Invoke dialog, set these values:

    The Invoke dialog should look like this:

    Figure 8-235 Invoke Dialog for the "UpdateOrderStatus" Invoke Activity

    Description of Figure 8-235 follows
    Description of "Figure 8-235 Invoke Dialog for the "UpdateOrderStatus" Invoke Activity"

  4. Click OK in the Invoke dialog.

  5. Select File > Save to save your work.

8.16.5 Minimize the "SetFinalOrderStatus" Scope

Click the [-] on the "SetFinalOrderStatus" scope to minimize it.

 

8.17 Send an Email Notification to the Customer ("NotifyCustomer" Scope)

This scope uses the notification service to send an email to the customer when the order is fulfilled.

Figure 8-236 shows the activities in the "NotifyCustomer" scope.

Figure 8-236 Activities in the "NotifyCustomer" Scope

Description of Figure 8-236 follows
Description of "Figure 8-236 Activities in the "NotifyCustomer" Scope"

8.17.1 Create the Notification Scope

  1. Drag the Email icon from the Component Palette and drop it below the "SetFinalOrderStatus" scope. This displays the Edit Email dialog.

  2. In the Edit Email dialog, enter any information you want for the email fields. Figure 8-237 shows an example.

    Figure 8-237 Edit Email Dialog

    Description of Figure 8-237 follows
    Description of "Figure 8-237 Edit Email Dialog"

    For most of the fields, you can click the XPath Expression Builder icon to display the Expression Builder. This enables you to customize the data for the field.

    Example 1: Entering the customer's email address in the To field:

    1. In the To field, click the XPath Expression Builder icon (the icon on the right).

    2. In the Expression Builder dialog, select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns4:PurchaseOrder > ns4:UserContact > ns4:EmailAddress.

    3. Click Insert Into Expression. The dialog should look like this:

      Figure 8-238 Expression Builder Dialog Showing the EmailAddress Field

      Description of Figure 8-238 follows
      Description of "Figure 8-238 Expression Builder Dialog Showing the EmailAddress Field"

    4. Click OK.

     

    Example 2: Including the customer name, order ID, and order status in the Body of the email. The text that you want to enter looks like this:

    Dear firstName
    
    This is to inform you that your order number, orderID, has been
    orderStatus
    If you have a question about your order, please contact customer service or
    send an email to customerservice@globalcompany.com
    
    Thank you for doing business with Global Company. We appreciate your business!
    Global Company Customer Service
    
    

    firstName, orderID, and orderStatus are placeholders for data that are to be retrieved dynamically.

    1. Click the XPath Expression Builder icon for Body.

    2. You will use the concat function to concatenate the pieces of the body text.

      Start by entering the following line in the Expression box:

      concat(string('Dear '), )
      
      
    3. Place the insertion point before the last closing parenthesis.

    4. Add the variable for first name: select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns4:PurchaseOrder > ns4:ShipTo > ns4:Name > ns4:First.

    5. Click Insert Into Expression. The expression now looks like this:

      concat(string('Dear '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ShipTo/
      ns4:Name/ns4:First'))
      
      
    6. Add the next part of the message, up to order ID: place the insertion point before the last closing parenthesis, and type in the next part of the message, shown in bold:

      concat(string('Dear '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ShipTo/
      ns4:Name/ns4:First'), string('This is to inform you that your order number '), )
      
      

      You cannot insert line breaks in the Expression box but you can insert line breaks in the Edit Email dialog.

    7. Place the insertion point before the last closing parenthesis.

    8. Add the variable for the order ID: select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns4:PurchaseOrder > ns4:ID.

    9. Click Insert Into Expression. The expression now looks like this:

      concat(string('Dear '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ShipTo/
      ns4:Name/ns4:First'), string('This is to inform you that your order
      number '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ID'))
      
      
    10. Add the string "has been " to the message. The new part is shown in bold.

      concat(string('Dear '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ShipTo/
      ns4:Name/ns4:First'), string('This is to inform you that your order
      number '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ID')
      , string('has been '), )
      
      
    11. Place the insertion point before the last closing parenthesis.

    12. Add the variable for the order status: select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns4:PurchaseOrder > ns4:OrderInfo > ns4:OrderStatus.

    13. Click Insert Into Expression. The expression now looks like this:

      concat(string('Dear '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ShipTo/
      ns4:Name/ns4:First'), string('This is to inform you that your order
      number '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ID')
      , string('has been '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:OrderInfo/
      ns4:OrderStatus'))
      
      
    14. Add the final part of the message, shown in bold:

      concat(string('Dear '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ShipTo/
      ns4:Name/ns4:First'), string('This is to inform you that your order
      number '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ID')
      , string('has been '), bpws:getVariableData('inputVariable','payload',
      '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:OrderInfo/
      ns4:OrderStatus'), string('If you have a question about your order, please
      contact customer service or send an email to
      customerservice@globalcompany.com
      Thank you for doing business with Global Company. We appreciate your
      business!
      Global Company Customer Service'))
      
      
    15. Click OK in the Expression Builder. The Edit Email dialog now looks like the following. Line breaks have been added to the body text to make it easier to read.

      Figure 8-239 Edit Email Dialog

      Description of Figure 8-239 follows
      Description of "Figure 8-239 Edit Email Dialog"

  3. Click OK in the Edit Email dialog.

  4. Select File > Save to save your work.

If you expand the "Email_1" activity, you can see that it contains two activities: an assign activity and an invoke activity. You do not have to edit these activities.

The assign activity, "EmailParamsAssign", contains the information that you provided in the Edit Email dialog.

The invoke activity, "InvokeNotificationService", calls on the notification service to send the emails.

8.17.2 Minimize the "Email_1" Scope

Click the [-] on the "Email_1" scope to minimize it.

8.17.3 Rename the "Email_1" Scope

To rename the "Email_1" scope, right-click the minimized scope and select Rename. Then type the new name, NotifyCustomer, and press Return.

 

8.18 Call Back the Client ("callbackClient" Invoke Activity)

This invoke activity returns status to the client.

Figure 8-240 "callbackClient" Invoke Activity

Description of Figure 8-240 follows
Description of "Figure 8-240 "callbackClient" Invoke Activity"

8.18.1 Create the Invoke Activity

  1. Drag the Invoke icon from the Component Palette and drop it below the "NotifyCustomer" (which is the "Email_1" scope) scope.

  2. Do one of the following to display the Invoke dialog:

    • Drag one of the arrows on the side of the new invoke activity and drop it on the "client" partner link. This associates the invoke activity with the partner link.

    • Double-click the new invoke activity.

  3. In the Invoke dialog, set these values:

    The Invoke dialog should look like this:

    Figure 8-243 Invoke Dialog for the "callbackClient" Invoke Activity

    Description of Figure 8-243 follows
    Description of "Figure 8-243 Invoke Dialog for the "callbackClient" Invoke Activity"

  4. Select File > Save to save your work.

8.18.2 Add a Sensor

You can add a sensor to the "callbackClient" invoke activity to write information for completed orders to different destination types such as databases, files, or JMS.

Recall that you also created a sensor at the beginning of the project, for the "receiveInput" receive activity described in Section 8.6, "Receive Input from the Client (Receive Activity)".

  1. Double-click the "callbackClient" invoke activity. This displays the Invoke dialog.

  2. Click the Sensors tab in the Invoke dialog.

  3. Click Create to create a new sensor. This displays the Create Activity Sensor dialog.

  4. In the Create Activity Sensor dialog, set the Name to InstanceCompleted.

  5. Set the Evaluation Time to Completion. This specifies when the sensor fires. Completion signifies that the sensor fires after this activity has run.

  6. In the Activity Variable Sensors section, click Create to display the Create Activity Variable Sensor dialog.

    Figure 8-244 Create Activity Variable Sensor Dialog

    Description of Figure 8-244 follows
    Description of "Figure 8-244 Create Activity Variable Sensor Dialog"

  7. In the Create Activity Variable Sensor dialog, click the pencil icon for Variable XPath. This displays the Variable XPath Builder dialog.

    Figure 8-245 Variable XPath Builder Dialog

    Description of Figure 8-245 follows
    Description of "Figure 8-245 Variable XPath Builder Dialog"

  8. Select Variables > Process > Variables > inputVariable.

  9. Click OK in the Variable XPath Builder dialog. The Create Activity Variable Sensor dialog should be filled in with these values for you (see Figure 8-244):

    Variable XPath: $inputVariable

    Output Namespace: http://www.globalcompany.com/ns/OrderBooking

    Output Datatype: SOAOrderBookingRequestMessage

  10. Click OK in the Create Activity Variable Sensor dialog. This takes you back to the Create Activity Sensor dialog, which now looks like this.

    Figure 8-246 Create Activity Sensor Dialog

    Description of Figure 8-246 follows
    Description of "Figure 8-246 Create Activity Sensor Dialog"

  11. In the Create Activity Sensor dialog, click the Add icon in the Sensor Actions section. This displays the Sensor Action Chooser dialog. It shows an existing sensor called InstanceStart, which you created in Section 8.6.2, "Create a Sensor for the Receive Activity".

    Figure 8-247 Sensor Action Chooser Dialog

    Description of Figure 8-247 follows
    Description of "Figure 8-247 Sensor Action Chooser Dialog"

  12. In the Sensor Action Chooser dialog, select Sensor Actions and select Sensor Action from the wand icon. This displays the Create Sensor Action dialog.

  13. In the Create Sensor Action dialog:

    • Name: enter InstanceCompleted.

    • Publish Type: select JMS Topic.

    • JMS Connection Factory: enter jms/TopicConnectionFactory.

    • Publish Target: enter jms/demoTopic.

    • Filter: leave blank.

    • Enable: select this option.

    Figure 8-248 Create Sensor Action Dialog

    Description of Figure 8-248 follows
    Description of "Figure 8-248 Create Sensor Action Dialog"

  14. Click OK in the Create Sensor Action dialog. The Sensor Action Chooser dialog now shows the InstanceCompleted sensor action.

    Figure 8-249 Sensor Action Chooser Dialog

    Description of Figure 8-249 follows
    Description of "Figure 8-249 Sensor Action Chooser Dialog"

  15. Click OK in the Sensor Action Chooser. This takes you back to the Create Activity Sensor dialog, which now looks like this:

    Figure 8-250 Create Activity Sensor Dialog

    Description of Figure 8-250 follows
    Description of "Figure 8-250 Create Activity Sensor Dialog"

  16. Click OK in the Create Activity Sensor dialog.

    In the Invoke dialog, the Sensors tab now looks like this:

    Figure 8-251 Invoke Dialog, Sensors Tab

    Description of Figure 8-251 follows
    Description of "Figure 8-251 Invoke Dialog, Sensors Tab"

  17. Click OK in the Invoke dialog.

  18. Select File > Save to save your work.

 

8.19 Add a Catch Branch to the Project

Add a catch branch to the project as a whole so that you can update the order status in the database in case an error occurs anywhere in the project.

Figure 8-252 shows the activity in the catch.

Figure 8-252 Activities in the "client:OrderBookingFault" Catch

Description of Figure 8-252 follows
Description of "Figure 8-252 Activities in the "client:OrderBookingFault" Catch"

8.19.1 Add a "client:OrderBookingFault" Catch

  1. Click the triangular icon with an exclamation point at the "SOAOrderBooking" scope to add a catch branch to the project. Adding it at this level enables all activities in the project to use this catch.

    Figure 8-253 "Add Catch Branch" Icon at the SOAOrderBooking Scope

    Description of Figure 8-253 follows
    Description of "Figure 8-253 "Add Catch Branch" Icon at the SOAOrderBooking Scope"

  2. Scroll to the right to see the new catch branch, and expand it. The new branch does not have any activity in it.

    Figure 8-254 New Catch Branch

    Description of Figure 8-254 follows
    Description of "Figure 8-254 New Catch Branch"

  3. Double-click the catch icon to display the Catch dialog.

  4. In the Catch dialog;

    • Namespace URI: enter http://www.globalcompany.com/ns/OrderBooking.

    • Local Part: enter OrderBookingFault.

    • Fault Variable: enter OrderBookingFault.

    Figure 8-255 Catch Dialog

    Description of Figure 8-255 follows
    Description of "Figure 8-255 Catch Dialog"

  5. Click OK in the Catch dialog.

8.19.2 Create a Scope

Create a scope in the catch area because you need to define a variable for the activities in the catch area.

  1. Drag the Scope icon from the Component Palette and drop it in the catch area.

  2. Double-click the new scope to display the Scope dialog.

  3. In the Scope dialog, in the General tab:

    • Name: enter SetOrderStatus.

    • Variable Access Serializable: do not select.

  4. Click the Variables tab. You need to create a variable for this scope.

  5. In the Variables tab, click Create.

  6. In the Create Variable dialog:

    • Name: enter orderStatusRequest.

    • Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > OrderStatus > OrderStatus.wsdl > Message Types > OrdersColllection_msg.

      Figure 8-256 Type Chooser Dialog for orderStatusRequest Variable

      Description of Figure 8-256 follows
      Description of "Figure 8-256 Type Chooser Dialog for orderStatusRequest Variable"

      Click OK in the Type Chooser.

  7. In the Create Variable dialog, the Message Type is set to {http://xmlns.oracle.com/pcbpel/adapter/db/OrderStatus/}OrdersCollection_msg.

    Figure 8-257 Create Variable Dialog for orderStatusRequest Variable

    Description of Figure 8-257 follows
    Description of "Figure 8-257 Create Variable Dialog for orderStatusRequest Variable"

  8. Click OK in the Create Variable dialog.

  9. The orderStatusRequest variable appears in the Variables tab of the Scope dialog.

    Figure 8-258 Scope Dialog for Catch, Variables Tab

    Description of Figure 8-258 follows
    Description of "Figure 8-258 Scope Dialog for Catch, Variables Tab"

    Click OK in the Scope dialog.

8.19.3 Create the Assign Activity

  1. Expand the "SetOrderStatus" scope.

  2. Drag the Assign activity icon from the Component Palette and drop it in the "SetOrderStatus" scope.

  3. Double-click the new assign activity to display the Assign dialog.

  4. In the Assign dialog, click the General tab, and set the Name to AssignOrderStatus.

  5. Still in the Assign dialog, click the Copy Operation tab. You will create three copy operations.

  6. Create the first copy operation: Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.

    • In the From side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:ID.

    • In the To side, set Type to Variable, and select Variables > Process > Scope - SetOrderStatus > Variables > orderStatusRequest > OrdersCollection > ns19:OrdersCollection > ns19:Orders >ns19:ordid.

    Figure 8-259 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, First Copy Operation

    Description of Figure 8-259 follows
    Description of "Figure 8-259 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, First Copy Operation"

    Click OK in the Create Copy Operation dialog.

  7. Create the second copy operation: Select Copy Operation from the Create dropdown again. This displays the Create Copy Operation dialog.

    • In the From side, set Type to Expression, and enter the following line in the Expression box:

      string('canceled')
      
      
    • In the To side, set Type to Variable, and select Variables > Process > Scope - SetOrderStatus > Variables > orderStatusRequest > OrdersCollection > ns19:OrdersCollection > ns19:Orders >ns19:status.

    Figure 8-260 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Second Copy Operation

    Description of Figure 8-260 follows
    Description of "Figure 8-260 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Second Copy Operation"

    Click OK in the Create Copy Operation dialog.

  8. Create the third copy operation: Select Copy Operation from the Create dropdown again. This displays the Create Copy Operation dialog.

    • In the From side, set Type to Variable, and select Variables > Process > Variables > OrderBookingFault > payload > client:SOAOrderBookingProcessFault > client:status.

    • In the To side, set Type to Variable, and select Variables > Process > Scope - SetOrderStatus > Variables > orderStatusRequest > OrdersCollection > ns19:OrdersCollection > ns19:Orders >ns19:comments.

    Figure 8-261 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Third Copy Operation

    Description of Figure 8-261 follows
    Description of "Figure 8-261 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Third Copy Operation"

    Click OK in the Create Copy Operation dialog.

  9. You should see the three copy operations in the Assign dialog. Click OK.

    Figure 8-262 Assign Dialog for "AssignOrderStatus" Activity

    Description of Figure 8-262 follows
    Description of "Figure 8-262 Assign Dialog for "AssignOrderStatus" Activity"

  10. Select File > Save to save your work.

8.19.4 Create the Invoke Activity

  1. Drag the Invoke icon from the Component Palette and drop it below the "AssignOrderStatus" assign activity in the catch area.

  2. Do one of the following to display the Invoke dialog:

    • Drag one of the arrows on the side of the new invoke activity and drop it on the "OrderStatus" database adapter. This associates the invoke activity with the database adapter.

    • Double-click the new invoke activity.

  3. In the Invoke dialog, set these values:

    The Invoke dialog should look like this:

    Figure 8-265 Invoke Dialog for the "SetFaultedOrderStatus" Invoke Activity

    Description of Figure 8-265 follows
    Description of "Figure 8-265 Invoke Dialog for the "SetFaultedOrderStatus" Invoke Activity"

  4. Click OK in the Invoke dialog.

  5. Select File > Save to save your work.

8.19.5 Create a Sensor in the Invoke Activity

Create a sensor in the "SetFaultedOrderStatus" invoke activity to write order information for orders that did not complete for any reason to different destinations such as databases, files, or JMS. In this case, you write to a JMS topic.

  1. Double-click the "SetFaultedOrderStatus" invoke activity to display the Invoke dialog.

  2. Click the Sensors tab in the Invoke dialog.

  3. Click Create to create a new sensor. This displays the Create Activity Sensor dialog.

  4. In the Create Activity Sensor dialog, set the Name to InstanceFaulted.

  5. Set the Evaluation Time to Completion. This specifies when the sensor fires. Completion signifies that the sensor fires after this activity has run.

  6. In the Activity Variable Sensors section, click Create to display the Create Activity Variable Sensor dialog.

    Figure 8-266 Create Activity Variable Sensor Dialog

    Description of Figure 8-266 follows
    Description of "Figure 8-266 Create Activity Variable Sensor Dialog"

  7. In the Create Activity Variable Sensor dialog, click the pencil icon for Variable XPath. This displays the Variable XPath Builder dialog.

    Figure 8-267 Variable XPath Builder Dialog

    Description of Figure 8-267 follows
    Description of "Figure 8-267 Variable XPath Builder Dialog"

  8. Select Variables > Process > Variables > OrderBookingFault.

  9. Click OK in the Variable XPath Builder. The Create Activity Variable Sensor dialog should be filled in with these values for you (see Figure 8-266):

    Variable XPath: $OrderBookingFault

    Output Namespace: http://www.globalcompany.com/ns/OrderBooking

    Output Datatype: SOAOrderBookingFaultMessage

  10. Click OK in the Create Activity Variable Sensor dialog. This takes you back to the Create Activity Sensor dialog, which now looks like this.

    Figure 8-268 Create Activity Sensor Dialog

    Description of Figure 8-268 follows
    Description of "Figure 8-268 Create Activity Sensor Dialog"

  11. In the Create Activity Sensor dialog, click the Add icon in the Sensor Actions section. This displays the Sensor Action Chooser dialog. It shows existing sensors called InstanceStart and InstanceCompleted, which you created in Section 8.6.2, "Create a Sensor for the Receive Activity" and Section 8.18.2, "Add a Sensor".

    Figure 8-269 Sensor Action Chooser Dialog

    Description of Figure 8-269 follows
    Description of "Figure 8-269 Sensor Action Chooser Dialog"

  12. In the Sensor Action Chooser dialog, select Sensor Actions and select Sensor Action from the wand icon. This displays the Create Sensor Action dialog.

  13. In the Create Sensor Action dialog:

    • Name: enter InstanceFaulted.

    • Publish Type: select JMS Topic.

    • JMS Connection Factory: enter jms/TopicConnectionFactory.

    • Publish Target: enter jms/demoTopic.

    • Filter: leave blank.

    • Enable: select this option.

    Figure 8-270 Create Sensor Action Dialog

    Description of Figure 8-270 follows
    Description of "Figure 8-270 Create Sensor Action Dialog"

  14. Click OK in the Create Sensor Action dialog. The Sensor Action Chooser dialog now shows the InstanceFaulted sensor action.

    Figure 8-271 Sensor Action Chooser Dialog

    Description of Figure 8-271 follows
    Description of "Figure 8-271 Sensor Action Chooser Dialog"

  15. Click OK in the Sensor Action Chooser. This takes you back to the Create Activity Sensor dialog, which now looks like this:

    Figure 8-272 Create Activity Sensor Dialog

    Description of Figure 8-272 follows
    Description of "Figure 8-272 Create Activity Sensor Dialog"

  16. Click OK in the Create Activity Sensor dialog.

    In the Invoke dialog, the Sensors tab now looks like this:

    Figure 8-273 Invoke Dialog, Sensors Tab

    Description of Figure 8-273 follows
    Description of "Figure 8-273 Invoke Dialog, Sensors Tab"

  17. Click OK in the Invoke dialog.

  18. Select File > Save to save your work.

8.20 Deploy the Project

  1. Double-click build.properties, located under SOAOrderBooking > 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, 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 SOAOrderBooking directory and click Open.

    The Run Ant dialog should look like this:

    Figure 8-274 Run Ant Dialog, Properties Tab, With build.properties File Loaded

    Description of Figure 8-274 follows
    Description of "Figure 8-274 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 8.20.1, "Deploying Using Ant from the Developer Prompt".

8.20.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. 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 SOAOrderBooking 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\SOAOrderBooking directory, where SOADEMO refers to the directory where you created the SOA Order Booking application.

    > cd SOADEMO
    > cd SOAOrderBooking
    
    

    If you are running JDeveloper and Oracle Application Server on separate machines, you can copy the SOAOrderBooking 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
    
    

8.20.2 Viewing SOAOrderBooking in the Oracle BPEL Control

After deployment, SOAOrderBooking 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.

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

Figure 8-275 Oracle BPEL Control Showing SOAOrderBooking

Description of Figure 8-275 follows
Description of "Figure 8-275 Oracle BPEL Control Showing SOAOrderBooking"

If you want to look at the WSDL for the SOAOrderBooking project, you can enter the following URL in a browser:

http://hostname:port/orabpel/default/SOAOrderBooking/1.0/SOAOrderBooking?wsdl