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 write functionality to the file adapter to accept input data in the form of a purchase order.
This chapter contains the following topics:
This phase of the tutorial adds to the process you designed in Chapter 8, "Using the File Adapter's Read Functionality". Ensure that you have successfully completed that phase before performing this one. In this phase of the tutorial, you add write functionality to the file adapter and use the transformation logic you designed in Chapter 7, "Adding Transformation Logic". You perform the following key tasks:
Return to the POAcknowledge BPEL process and create a partner link (named FileOutInbound) that uses the file adapter to write files to a directory (in this case, an outgoing purchase order acknowledgment).
Design POAcknowledge to invoke FileOutInbound.
Deploy POAcknowledge.
Return to the OrderBooking BPEL process and create a partner link (named WritePOA) that interacts with POAcknowledge.
Design OrderBooking to invoke WritePOA.
Deploy the OrderBooking BPEL process.
Run OrderBooking from Oracle BPEL Control by completing and submitting an order form to the Rapid Distributors and Select Manufacturing services.
Copy the purchase order file to be read to a directory.
Access the Rapid Distributors URL to manually submit a supplier price.
Observe that the purchase order file is deleted and a purchase order acknowledgment file is written to the directory. Observe that the contents of the incoming purchase order file are transformed into an outgoing purchase order acknowledgment.
This section contains these tasks:
Creating a Partner Link that Uses the File Write Functionality of the File Adapter
Validating, Compiling, and Deploying the Order Booking Process
Summary:
You now create a partner link that uses the file adapter in the outbound direction. You configure the file adapter to write a file to a specified directory. In this phase, you work from the POAcknowledge project.Click the POAcknowledge project in the Application Navigator section of the designer window.
Double-click POAcknowledge.bpel.
Select Services from the Component Palette section.
Drag and drop a PartnerLink activity from the Component Palette section 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 9.
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 FileWrite in the Service Name field on the Service Name window and click Next.
Select Write File as the Operation Type on the Operation window and click Next. Note that the Operation Name field is automatically filled in with Write.
Select Directory Specified as Physical Path.
Click Browse next to the Directory for Outgoing Files (physical path) field.
Select the directory in which to create 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.
Enter po_% in the File Naming Convention field.
A list of naming conventions automatically appears.
Select yyMMddHHmmss from the list that appears.
A closing % sign is automatically added.
Enter .xml to the end of your selection.
A name of po_%yyMMddHHmmss%.xml now appears in the File Naming Convention field.
Unselect the Number of Messages Equal, Elapsed Time Exceeds, and File Size Exceeds check boxes and click Next.
Click Browse next to the Schema Location field on the Messages window.
Select Project Schema Files > POAcknowledge.xsd > POAcknowledge in the Type Chooser window.
Click OK.
The Schema Location field (POAcknowledge.xsd) and the Schema Element field (POAcknowledge) 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:
Field | Value |
---|---|
Name | FileWrite |
WSDL File | file:/c:/oraJDev/jdev/mywork/OrderBookapplication/POAcknowledge/bpel/FileWrite.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 | Write_plt |
Partner Role | Write_role |
My Role | Leave unspecified. |
Click OK.
Select Save from the File main menu.
Note that FileWrite.wsdl now appears under POAcknowledge > Integration Content > FileWrite. This file contains the parameters you specified with the Adapter Configuration Wizard.
Summary:
This Invoke activity writes order acknowledgment data results into a file.Select Process Activities from the Component Palette section.
Drag and drop an Invoke activity from the Component Palette section to below the transformPO Transform activity.
Double-click the Invoke icon to display the Invoke window.
Enter the following details:
Field | Value |
---|---|
Name | invokeFileOut |
Partner Link | FileWrite |
The Operation (Write) 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 invokeFileOut_write_InputVariable is automatically created in the Input Variable field. This variable is automatically assigned a message type of FileWritePOAcknowledge_msg.
Click OK.
Select Save from the File main menu.
Drag and drop an Assign activity from the Component Palette section to above the invokeFileOut Invoke activity.
Double-click the assign icon to display the Assign window.
Click the General tab.
Enter assignFileWriteIn 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 > outputVariable > payload |
To | |
|
Variable |
|
Expand and select Variables > invokeFileOut_Write_InputVariable > POAcknowledge |
Click OK to close the Create Copy Operation window and the Assign window.
Select Save from the File main menu.
Go to the Application Navigator section.
Right-click POAcknowledge.
Select Deploy > my_integration_server_connection > Deploy to default domain.
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 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.
The Dashboard tab of Oracle BPEL Control appears. Note that your BPEL process, POAcknowledge, now appears in the Deployed BPEL Processes list.
Click POAcknowledge.
Enter details in all fields of the HTML Form and click Post XML Message.
Refresh Oracle BPEL Control.
Click the Instances tab.
Click the POAcknowledge instance.
View the output file written in the directory you selected in Step 13 (drive_letter
:\temp
on Windows operating systems or /temp
on Unix operation systems).
Summary:
You now extend the original OrderBooking process to call the newly-created POAcknowledge service to write a PO acknowledgment in a file. You perform these steps in the OrderBooking process.Expand the OrderBooking process in the Application Navigator section.
Double-click OrderBooking.bpel.
Select Services from the Component Palette section.
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 OrderBooking 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 a purchase order acknowledgment service.Field | Value |
---|---|
Name | WritePOA
Note: Enter WritePOA after selecting the WSDL File. This is because the name automatically defaults to POAcknowledge based on your selection in the WSDL File field. |
WSDL File | Access this URL by clicking the Service Explorer flashlight icon and expanding and selecting BPEL Services > my_ integration_server_connection > processes > default > POAcknowledge
http://localhost:8888/orabpel/default/POAcknowledge/POAcknowledge?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 | POAcknowledge |
Partner Role | POAcknowledgeProvider |
My Role | POAcknowledgeRequester |
Click OK.
Select Save from the File main menu.
Summary:
You now create a Scope activity to group all activities that form a logical step to be executed.Select Process Activities from the Component Palette section.
Drag and drop a Scope activity from the Component Palette section to below the SelectSupplier Switch activity.
Double-click the scope icon to display the Scope window.
Enter WritePOAcknowledgment in the Name field of the General tab.
Click OK.
In this phase of the tutorial, you create the Invoke, Receive, and Assign activities inside this Scope activity.
Click the + sign to expand the Scope activity.
Select Save from the File main menu.
Summary:
You now create Invoke and Receive activities. The Invoke activity provide an initiate operation that sends input data. The Receive activity provides a callback interface to receive data after the external service is processed.Drag and drop an Invoke activity from the Component Palette section to inside the WritePOAcknowledgment Scope activity.
Double-click the Invoke icon to display the Invoke window.
Enter the following details:
Field | Value |
---|---|
Name | invokeFileWrite |
Partner Link | WritePOA |
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 invokeFileWrite_initiate_InputVariable is automatically created in the Input Variable field. This variable is automatically assigned a message type of POAcknowledgeRequestMessage.
Click OK.
Drag and drop a Receive activity from the Component Palette section to below the invokeFileWrite Invoke activity inside the WritePOAcknowledgment Scope activity.
Double-click the Receive icon to display the Receive window.
Enter the following details:
Field | Value |
---|---|
Name | receiveFileWrite |
Partner Link | WritePOA |
The Operation (onResult) 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 receiveFileWrite_onResult_InputVariable is automatically created in the Output Variable field. This variable is automatically assigned a message type of POAcknowledgeResponseMessage.
Click OK.
Select Save from the File main menu.
Drag and drop an Assign activity from the Component Palette section to above the invokeFileWrite Invoke activity inside the WritePOAcknowledgment Scope activity.
Double-click the assign icon to display the Assign window.
Click the General tab.
Enter assignFileWriteIn in the Name field.
Click Apply.
Click the Copy Operations tab.
Click Create and select Copy Operation to display the Create Copy Operation window.
Field | Value |
---|---|
From | |
|
Variable |
|
Expand and select Variables > inputVariable > payload |
To | |
|
Variable |
|
Expand and select Variables > invokeFileWrite_initiate_InputVariable > payload |
Click OK to close the Create Copy Operation window and the Assign window.
Select Save from the File main menu.
Drag and drop an Assign activity from the Component Palette section to below the receiveFileWrite Receive activity inside the WritePOAcknowledgment Scope activity.
Double-click the assign icon to display the Assign window.
Click the General tab.
Enter assignFileWriteComments in the Name field.
Click Apply.
Click the Copy Operation tab.
Click Create and select Copy Operation to display the Create Copy Operation window.
Note:
Instead of manually entering an expression, you can press Ctrl and then the space bar in the Expression field. Scroll through the list of values that appears and double-click the value you want. Edit the value as necessary. As you enter information, a trailing slash can appear. This means you are being prompted for additional information. Either enter additional information, or press the Esc key and delete the trailing slash to complete the input of information.Field | Value |
---|---|
From | |
|
Expression |
|
concat(bpws:getVariableData('inputVariable','payload','/ns1:PurchaseOrder/ns1:OrderInfo/ns1:OrderComments'), ' - Write POAck complete') |
To | |
|
Variable |
|
Expand and select Variables > inputVariable > payload > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderComments |
Click OK to close the Create Copy Operation window and the Assign window.
When complete, the designer window looks as follows:
Click the - sign to close the WritePOAcknowledgment Scope activity.
Select Save from the File main menu.
Go to the Application Navigator section.
Right-click OrderBooking.
Select Deploy > my_integration_server_connection > Deploy to default domain.
Increment the version number of the project when prompted and click OK (for example, enter 1.5).
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.
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 |
The Dashboard tab of Oracle BPEL Control appears. Note that your BPEL processes, POAcknowledge and OrderBooking, appear in the Deployed BPEL Processes list.
Click the OrderBooking instance version you increased in Step 4 and start it in one of the following ways:
Open the provided CreateOrderBookingUI application at http://localhost:8888/CreateOrderBookingUI
and provide inputs to initiate a process.
Enter details in all fields of the HTML Form and click Post XML Message.
Click the XML Source radio button. Use a text editor to copy and paste the contents of the OrderBookingPO_1.xml
file into the field that appears. Click Post XML Message.
Copy the OrderBookingPO_1.xml
file to the directory you previously selected to invoke the process instance (drive_letter
:\temp
on Windows operating systems or /temp
on Unix operation systems). This step is optional if the BatchOrderProcessing process of section "Running and Verifying the Order Process" is complete.
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.
Refresh Oracle BPEL Control.
Click the Instances tab at the top.
Verify that the instances were created. All should appear in the Instance list. The Last Modified list displays the times at which they were created.
Click the instance.
Check the contents of the directory (drive_letter
:\temp
on Windows operating systems or /temp
on Unix operation systems). An output file named po_
timestamp
.xml
should be created. Verify the attributes (for example the concatenation of the first and last names, and so on).
You have now added write functionality to the file adapter to accept input data in the form of a purchase order. This input data was transformed into a purchase order acknowledgment and the results were written to a file. You performed the following key tasks:
Returned to the POAcknowledge BPEL process and created a partner link (named FileOutInbound) that used the file adapter to write files to a directory (in this case, an outgoing purchase order acknowledgment).
Designed POAcknowledge to invoke FileOutInbound.
Deployed POAcknowledge.
Returned to the OrderBooking BPEL process and created a partner link (named WritePOA) that interacted with POAcknowledge.
Designed OrderBooking to invoke WritePOA.
Deployed the OrderBooking BPEL process.
Ran OrderBooking from Oracle BPEL Control by completing and submitting an order form to the Rapid Distributors and Select Manufacturing services.
Copied the purchase order file to be read to a directory.
Accessed the Rapid Distributors URL to manually submit a supplier price.
Observed that the purchase order file was deleted and a purchase order acknowledgment file was written to the directory. Observed that the contents of the incoming purchase order file were transformed into an outgoing purchase order acknowledgment.