Oracle® BPEL Process Manager Order Booking Tutorial
10g Release 2 (10.1.2) B15813-02 |
|
Previous |
Next |
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:
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:
Create a new BPEL process named BatchOrderProcessing.
Create a partner link that uses the file adapter (named FileReadAdapter) to read and then delete files from a directory (in this case, an incoming purchase order).
Create a partner link with which to interact (in this case, the OrderBooking BPEL process you previously designed is now used as a service).
Design the BPEL process to invoke both OrderBooking and FileReadAdapter.
Deploy the BatchOrderProcessing BPEL process.
Run the deployed BPEL process from Oracle BPEL Console.
Place a file in a directory and observe that the file is read and then deleted after OrderBooking returns a response.
This section contains the following tasks:
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.
Right-click OrderBookworkspace in the Applications Navigator section of the designer window.
Select New Project.
Double-click BPEL Process Project in the Items window to display the BPEL Process Project window.
Enter BatchOrderProcessing in the BPEL Process Name field.
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. |
Ensure that the Use Default check box is selected.
Click OK.
This creates the bpel.xml, BatchOrderProcessing.bpel, and BatchOrderProcessing.wsdl files in the Applications Navigator section of the designer window.
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.
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.
Select and right-click Project Schemas in the Structure section.
Select Import Schema.
The Import Schema window appears.
Click the flashlight icon to access the Open window.
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.
Click OK.
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.
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. |
Ensure that Process Activities is selected in the drop-down list of the Component Palette section.
Drag and drop a PartnerLink activity onto the right side of the designer window.
Enter FileReadAdapter in the Name field.
Click the third icon at the top (the Define Adapter Service icon). This starts the Adapter Configuration Wizard.
Click Next on the Welcome window.
Select File Adapter on the Adapter Type window and click Next.
Enter FileRead in the Service Name field on the Service Name window and click Next.
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.
Select Directory Names are Specified as Physical Path.
Click Browse next to the Directory for Incoming Files (physical path) field.
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.
Click Select.
Ensure that the Archive processed files check box is not selected.
Click Next.
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.
Click Next.
Enter 15 seconds in the Polling Frequency field.
Ensure that the Delete files after successful retrieval check box is selected.
Click Next.
Click Browse next to the Schema File URL field on the Messages window to display the Type Chooser window.
Select Project Schema Files > OrderBookingPO.xsd > PurchaseOrder.
Click OK.
The Schema File URL field (OrderBookingPO.xsd) and the Schema Element field (PurchaseOrder) are filled in.
Click Next.
Click Finish.
You are returned to the Partner Link window. All other fields are automatically completed. The window looks as follows:
Click OK.
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.
Summary: You now create a partner link to call the Order Booking process that you previously created as a BPEL process. |
Drag and drop a PartnerLink activity from the Component Palette section onto the right side of the designer window.
Enter the following values to create a partner link for the Order Booking process:
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 |
Click OK.
Select Save from the File main menu.
Summary: You now create Receive and Invoke activities. The Receive activity reads data from a file. The Invoke activity initiates a process in OrderBooking. |
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.
Double-click the Receive icon to display the Receive window.
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.
Click the first icon to the right of the Variable field. This is the automatic variable creation icon.
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.
Ensure that you selected the Create Instance check box, as mentioned in Step 3.
Click OK.
Drag and drop an Invoke activity from the Component Palette section to below the receive_FileIn Receive activity.
Double-click the Invoke icon to display the Invoke window.
Enter the following details:
Field | Value |
---|---|
Name | invoke_OrderBooking |
Partner Link | OrderBooking |
The Operation (initiate) field is automatically filled in.
Click the first icon to the right of the Input Variable field. This is the automatic variable creation icon.
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.
Click OK.
Select Save from the File main menu.
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. |
Drag and drop an Assign activity from the Component Palette section to below the receive_FileIn Receive activity.
Double-click the assign icon to display the Assign window.
Click the General tab.
Enter assignOrder in the Name field.
Click Apply.
Click the Copy Rules tab.
Click Create to display the Create Copy Rule window.
Field | Value |
---|---|
From |
|
|
Variable |
|
Expand and select Variables > receive_FileIn_Read_InputVariable > PurchaseOrder |
To |
|
|
Variable |
|
Expand and select Variables > invoke_OrderBooking_initiate_InputVariable > payload |
Click OK to close the Create Copy Rule window and the Assign window.
Select Save from the File main menu.
When complete, the designer window looks as follows:
Go to the Applications Navigator section.
Right-click BatchOrderProcessing.
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.
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.
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).
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.
Complete the manual price quote task for SelectManufacturing by using the graphical user interface JSP page, as described in Step 10.
Return to Oracle BPEL Console.
Click the Instance tab at the top.
Refresh Oracle BPEL Console and observe process instance creation and completion.
Click the instance.
Click the Audit link and click through other instances (of subprocesses) and follow the execution.
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.)
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:
Created a new BPEL process named BatchOrderProcessing.
Created a partner link that used the file adapter (named FileReadAdapter) to read and then delete files from a directory (in this case, an incoming purchase order).
Created a partner link with which to interact (in this case, the OrderBooking BPEL process you previously designed is now used as a service).
Designed the BPEL process to invoke both OrderBooking and FileReadAdapter.
Deployed the BatchOrderProcessing BPEL process.
Ran the deployed BPEL process from Oracle BPEL Console.
Placed a file in a directory and observed that the file was read and then deleted after OrderBooking returned a response.