Skip Headers
Oracle® BPEL Process Manager Order Booking Tutorial
10g Release 2 (10.1.2)
B15813-02
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

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

You must create a new project. Follow these instructions to create a new Batch Order Booking project. 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 OrderBookworkspace in the Applications Navigator section of the designer window.

  2. Select New Project.

  3. Double-click BPEL Process Project in the Items window to display the BPEL Process Project window.

  4. Enter BatchOrderProcessing in the BPEL Process Name field.

  5. Select Empty BPEL Process from the Template list.


    Note:

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

  6. Ensure that the Use Default check box is selected.

  7. Click OK.

    This creates the bpel.xml, BatchOrderProcessing.bpel, and BatchOrderProcessing.wsdl files in the Applications Navigator section of the designer window.

  8. Copy OrderBookingPO.xsd and OrderBookingPO_1.xml from the Oracle_Home\integration\orabpel\samples\tutorials\127.OrderBookingTutorials\PracticeFiles directory to the Oracle_Home\integration\jdev\jdev\mywork\OrderBookworkspace\BatchOrderProcessing directory.

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

  10. Select and right-click Project Schemas in the Structure section.

  11. Select Import Schema.

    The Import Schema window appears.

  12. Click the flashlight icon to access the Open window.

  13. Select OrderBookingPO.xsd from the BatchOrderProcessing directory in which you placed it in Step 8 and click Open.

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

  14. Click OK.

  15. Verify that OrderBookingPO.xsd appears under BatchOrderProcessing > Web Content > Miscellaneous Files in the Applications Navigator section of the designer window. OrderBookingPO.xsd also appears under Project 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 Process Activities 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. Enter FileReadAdapter in the Name field.

  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. Click Next.

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

  16. Click Next.

  17. Enter 15 seconds in the Polling Frequency field.

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

  19. Click Next.

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

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

  22. Click OK.

    The Schema File URL 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 FileReadAdapter
    WSDL File file:/c:/oraBPEL/integration/jdev/jdev/mywork/OrderBookworkspace/BatchOrderProcessing/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.

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

  25. Click OK.

  26. Select Save from the File main menu.

    Note that FileRead.wsdl now appears under BatchOrderProcessing > Integration Content. 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 WSIL Browser) to access the WSDL Chooser window for automatically selecting the OrderBooking service.

    Field Value
    Name OrderBooking
    WSDL File Access this URL by clicking the WSIL Browser flashlight icon and expanding and selecting LocalBPELServer > processes > default > OrderBooking

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

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

    Partner Link Type OrderBooking
    My Role OrderBookingRequester
    Partner Role OrderBookingProvider

  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. 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", the designer window does not include or require the receiveInput Receive and callbackClient Invoke activities that are automatically created with an asynchronous BPEL process.

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

  3. Enter the following details:

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

    The Operation (Read) field is automatically filled in.

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

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

  6. Ensure that you selected the Create Instance check box, as mentioned in Step 3.

  7. Click OK.

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

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

  10. Enter the following details:

    Field Value
    Name invoke_OrderBooking
    Partner Link OrderBooking

    The Operation (initiate) field is automatically filled in.

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

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

  13. Click OK.

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

  7. Click Create to display the Create Copy Rule 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 Rule 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 Applications Navigator section.

  2. Right-click BatchOrderProcessing.

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

  4. Enter the domain password of bpel when prompted.

    This compiles the BPEL process. Review the bottom of the window for any errors. If there are no errors, deployment was successful. If deployment was unsuccessful, see Step 5.

8.2.7 Running and Verifying the Order Process

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

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

  2. Copy the OrderBookingPO_1.xml file from the Oracle_Home\integration\jdev\jdev\mywork\OrderBookworkspace\BatchOrderProcessing directory to the directory you specified in Step 11 (drive_letter:\temp on Windows operating systems or /temp on Unix operation systems).

  3. Refresh Oracle BPEL Console after allowing the polling frequency of 15 seconds that you set in Step 17 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.

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

  5. Return to Oracle BPEL Console.

  6. Click the Instance tab at the top.

  7. Refresh Oracle BPEL Console and observe process instance creation and completion.

  8. Click the instance.

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

  10. 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: