Skip Headers
Oracle® BPEL Process Manager Order Booking Tutorial
10g (10.1.3.1.0)

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

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

8 Using the File Adapter's Read Functionality

This chapter of the tutorial describes how to add a file adapter to read data from a file and call the OrderBooking BPEL process as an external service.

This chapter contains the following topics:

8.1 Introduction

This phase of the tutorial adds to the process you designed in Chapter 7, "Adding Transformation Logic". Ensure that you have successfully completed that phase before performing this one. In this phase of the tutorial, you add a file adapter to read data from a file and call the previously created OrderBooking BPEL process as a service. You perform the following key tasks:

8.2 Designing the File Adapter's Read Functionality to Activate a BPEL Process

This section contains the following tasks:

8.2.1 Creating a Batch Order Booking Process and Importing the Schema

Follow these instructions to create a new Batch Order Booking project and import the schema. Note that in this project, you create an empty BPEL process, and not an asynchronous process.

Caution:

Do not include any special characters in the project name (such as periods) or in any activity or element names. If you do include special characters, errors appear when you attempt to compile your project.
  1. Right-click OrderBookapplication and select New Project.

  2. Under Categories, expand General and click Projects.

  3. Under Items, click BPEL Process Project and click OK.

  4. In the BPEL Project Creation Wizard - Project Settings window, enter the following details and click Finish.

    Field Value
    Name BatchOrderProcessing
    Namespace Accept the default path.
    Use Default Project Settings Leave this checked to use the same name for the BPEL process and the BPEL project, and to use the default project directory.
    Template Empty BPEL Process

    Note:

    Ensure that you select Empty BPEL Process from the Template list. This project is different from previous projects that you created.

    This creates the bpel.xml and BatchOrderProcessing.bpel files in the Application Navigator section of the designer window.

  5. Double-click BatchOrderProcessing.bpel in the Application Navigator section of the designer window to display the Structure section in the lower left section of the designer window.

  6. Select and right-click Schemas in the Structure section.

  7. Select Import Schema.

    The Import Schema window appears.

  8. Click the flashlight icon next to the URL field.

  9. Select OrderBookingPO.xsd from the SOA_Oracle_Home\bpel\samples\tutorials\127.OrderBookingTutorial\PracticeFiles directory and click Open.

    The file is added to the URL field of the Import Schema window.

  10. Click OK.

  11. Verify that OrderBookingPO.xsd appears under BatchOrderProcessing > Integration Content > Schemas in the Application Navigator section of the designer window. OrderBookingPO.xsd also appears under Schemas in the Structure section.

8.2.2 Creating a Partner Link that Uses the File Read Functionality of the File Adapter

Summary:

You now create a partner link that uses the file adapter in the inbound direction. You configure the file adapter to check a specific directory every 15 seconds for files with a specified extension. This partner link serves as the input point for the process, and reads the files and provides input data (create instance) to the process.
  1. Ensure that Services is selected in the drop-down list of the Component Palette section.

  2. Drag and drop a PartnerLink activity onto the right side of the designer window.

  3. Leave the Name field empty. A name is automatically created when you run the Adapter Configuration Wizard based on the service name you enter in Step 7.

  4. Click the third icon at the top (the Define Adapter Service icon). This starts the Adapter Configuration Wizard.

    Description of adapter_service.gif follows
    Description of the illustration adapter_service.gif

  5. Click Next on the Welcome window.

  6. Select File Adapter on the Adapter Type window and click Next.

  7. Enter FileRead in the Service Name field on the Service Name window and click Next.

  8. Select Read File as the Operation Type on the Operation window and click Next. Note that the Operation Name field is automatically filled in with Read.

  9. Select Directory Names are Specified as Physical Path.

  10. Click Browse next to the Directory for Incoming Files (physical path) field.

  11. Select the directory from which to read files (drive_letter:\temp on Windows operating systems or /temp on UNIX operation systems). You must create this directory with the correct permissions if it does not exist.

  12. Click Select.

  13. Ensure that the Archive processed files check box is not selected.

  14. Ensure that the Delete files after successful retrieval check box is selected.

  15. Click Next.

  16. Enter OrderBooking*.xml in the Include Files with Name Pattern field. This convention specifies that any input files with this pattern are selected for processing.

  17. Click Next.

  18. Enter 15 seconds in the Polling Frequency field.

  19. Click Next.

  20. Click Browse next to the Schema Location field on the Messages window to display the Type Chooser window.

  21. Select Project Schema Files > OrderBookingPO.xsd > PurchaseOrder.

  22. Click OK.

    The Schema Location field (OrderBookingPO.xsd) and the Schema Element field (PurchaseOrder) are filled in.

  23. Click Next.

  24. Click Finish.

    You are returned to the Partner Link window. All other fields are automatically completed. The window looks as follows:

    Field Value
    Name FileRead
    WSDL File file:/c:/oraJDev/jdev/mywork/OrderBookapplication/BatchOrderProcessing/bpel/FileRead.wsdl.

    Note: This directory path with a drive letter represents an example on Windows operating systems. If running this tutorial on Unix operating systems, your directory path varies. In addition, oraJDev represents the Oracle JDeveloper home directory for this example.

    Partner Link Type Read_plt
    Partner Role Leave unspecified.
    My Role Read_role

  25. Click OK.

  26. Select Save from the File main menu.

    Note that FileRead.wsdl now appears under BatchOrderProcessing > Integration Content > FileRead. This file contains the parameters you specified with the Adapter Configuration Wizard.

8.2.3 Creating an Order Booking Partner Link

Summary:

You now create a partner link to call the Order Booking process that you previously created as a BPEL process.
  1. Drag and drop a PartnerLink activity from the Component Palette section onto the right side of the designer window.

  2. Enter the following values to create a partner link for the Order Booking process:

    Note:

    For the WSDL File field below, click the flashlight (the second icon from the left named Service Explorer) to access the Service Explorer window for automatically selecting the OrderBooking service.
    Field Value
    Name OrderBooking
    WSDL File Access this URL by clicking the Service Explorer flashlight icon and expanding and selecting BPEL Services > my_ integration_server_connection > processes > default > OrderBooking

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

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

    Partner Link Type OrderBooking
    Partner Role OrderBookingProvider
    My Role OrderBookingRequester

  3. Click OK.

  4. Select Save from the File main menu.

8.2.4 Creating Receive and Invoke Activities

Summary:

You now create Receive and Invoke activities. The Receive activity reads data from a file. The Invoke activity initiates a process in OrderBooking.
  1. Select Process Activities from the Component Palette section.

  2. Drag and drop a Receive activity from the Component Palette section into the designer window. Because you created an empty BPEL process in "Creating a Batch Order Booking Process and Importing the Schema", the designer window does not include or require the receiveInput Receive and callbackClient Invoke activities that are automatically created with an asynchronous BPEL process.

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

  4. Enter the following details:

    Field Value
    Name receive_FileIn
    Partner Link FileRead
    Create Instance Select this check box.

    The Operation (Read) field is automatically filled in.

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

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

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

  7. Ensure that you selected the Create Instance check box, as mentioned in Step 4.

  8. Click OK.

  9. Drag and drop an Invoke activity from the Component Palette section to below the receive_FileIn Receive activity.

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

  11. Enter the following details:

    Field Value
    Name invoke_OrderBooking
    Partner Link OrderBooking

    The Operation (initiate) field is automatically filled in.

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

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

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

  14. Click OK.

  15. Select Save from the File main menu.

8.2.5 Creating an Assign Activity

Summary:

You now create an Assign activity that passes the data read from a file to invoke_OrderBooking_initiate_InputVariable, the variable used for initiating activity with the OrderBooking process.
  1. Drag and drop an Assign activity from the Component Palette section to below the receive_FileIn Receive activity.

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

  3. Click the General tab.

  4. Enter assignOrder in the Name field.

  5. Click Apply.

  6. Click the Copy Operation tab.

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

  8. Enter the following details:

    Field Value
    From
    • Type
    Variable
    • Variables
    Expand and select Variables > receive_FileIn_Read_InputVariable > PurchaseOrder
    To
    • Type
    Variable
    • Variables
    Expand and select Variables > invoke_OrderBooking_initiate_InputVariable > payload

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

  10. Select Save from the File main menu.

    When complete, the designer window looks as follows:

    Description of obph7.gif follows
    Description of the illustration obph7.gif

8.2.6 Validating, Compiling, and Deploying the Order Process

  1. Go to the Application Navigator section.

  2. Right-click BatchOrderProcessing.

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

    This compiles the BPEL process. Check for errors by clicking the buttons at the bottom of the window. If there are no errors, deployment was successful. If deployment was unsuccessful, see Step 4.

8.2.7 Running and Verifying the Order Process

  1. Log into Oracle BPEL Control by selecting Start > All Programs > Oracle - Oracle_Home > Oracle BPEL Process Manager > BPEL Control (or refresh the page if it is already open).

  2. Enter the following details to log into Oracle BPEL Control and click Login:

    Field Value
    Username oc4jadmin
    Password password

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

    The Dashboard tab of Oracle BPEL Control appears. Note that your BPEL process, BatchOrderProcessing and a series of subprocesses on which it depends, now appears in the Deployed BPEL Processes list.

  3. Copy the OrderBookingPO_1.xml file from the SOA_Oracle_Home\bpel\samples\tutorials\127.OrderBookingTutorial\PracticeFiles directory to the directory you specified in Step 11 (drive_letter:\temp on Windows operating systems or /temp on Unix operation systems).

  4. Refresh Oracle BPEL Control after allowing the polling frequency of 15 seconds that you set in Step 18 to elapse. After the process starts, the file is read, deleted (if reading was successful), and sent to the OrderBooking process. Processing completes after OrderBooking returns a response.

  5. Complete the manual price quote task for SelectManufacturing by using the graphical user interface JSP page, as described in Step 11.

  6. Return to Oracle BPEL Control.

  7. Click the Instance tab at the top.

  8. Refresh Oracle BPEL Control and observe process instance creation and completion.

  9. Click the instance.

  10. Click the Audit link and click through other instances (of subprocesses) and follow the execution.

  11. Click the More link for each sequence to view the activity details. (Similar instance management can also be obtained in a graphical fashion under the Flow link.)

8.3 Summary

You have now added a file adapter to read data from a file and call the previously created OrderBooking BPEL process as a service. You performed the following key tasks: