Oracle® BPEL Process Manager Order Booking Tutorial 10g (10.1.3.1.0) Part Number B28987-01 |
|
|
View PDF |
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 FileRead) 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 FileRead.
Deploy the BatchOrderProcessing BPEL process.
Run the deployed BPEL process from Oracle BPEL Control.
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:
Creating a Batch Order Booking Process and Importing the Schema
Creating a Partner Link that Uses the File Read Functionality of the File Adapter
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.Right-click OrderBookapplication and select New Project.
Under Categories, expand General and click Projects.
Under Items, click BPEL Process Project and click OK.
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.
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.
Select and right-click Schemas in the Structure section.
Select Import Schema.
The Import Schema window appears.
Click the flashlight icon next to the URL field.
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.
Click OK.
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.
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 Services 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.
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.
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.
Ensure that the Delete files after successful retrieval check box is 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.
Click Next.
Click Browse next to the Schema Location field on the Messages window to display the Type Chooser window.
Select Project Schema Files > OrderBookingPO.xsd > PurchaseOrder.
Click OK.
The Schema Location 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 > FileRead. 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:
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 |
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.Select Process Activities from the Component Palette section.
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.
Double-click the Receive icon to display the Receive window.
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.
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 4.
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 Operation tab.
Click Create and select Copy Operation to display the Create Copy Operation 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 Operation window and the Assign window.
Select Save from the File main menu.
When complete, the designer window looks as follows:
Go to the Application Navigator section.
Right-click BatchOrderProcessing.
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.
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).
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.
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).
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.
Complete the manual price quote task for SelectManufacturing by using the graphical user interface JSP page, as described in Step 11.
Return to Oracle BPEL Control.
Click the Instance tab at the top.
Refresh Oracle BPEL Control 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 FileRead) 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 FileRead.
Deployed the BatchOrderProcessing BPEL process.
Ran the deployed BPEL process from Oracle BPEL Control.
Placed a file in a directory and observed that the file was read and then deleted after OrderBooking returned a response.