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

9 Using the File Adapter's Write Functionality

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:

9.1 Introduction

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:

9.2 Designing the File Adapter's Write Functionality to Write the Order Acknowledgment

This section contains these tasks:

9.2.1 Creating a Partner Link that Uses the File Write Functionality of the File Adapter

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.
  1. Click the POAcknowledge project in the Application Navigator section of the designer window.

  2. Double-click POAcknowledge.bpel.

  3. Select Services from the Component Palette section.

  4. Drag and drop a PartnerLink activity from the Component Palette section onto the right side of the designer window.

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

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

  7. Click Next on the Welcome window.

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

  9. Enter FileWrite in the Service Name field on the Service Name window and click Next.

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

  11. Select Directory Specified as Physical Path.

  12. Click Browse next to the Directory for Outgoing Files (physical path) field.

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

  14. Click Select.

  15. Enter po_% in the File Naming Convention field.

    A list of naming conventions automatically appears.

  16. Select yyMMddHHmmss from the list that appears.

    A closing % sign is automatically added.

  17. Enter .xml to the end of your selection.

    A name of po_%yyMMddHHmmss%.xml now appears in the File Naming Convention field.

  18. Unselect the Number of Messages Equal, Elapsed Time Exceeds, and File Size Exceeds check boxes and click Next.

  19. Click Browse next to the Schema Location field on the Messages window.

  20. Select Project Schema Files > POAcknowledge.xsd > POAcknowledge in the Type Chooser window.

  21. Click OK.

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

  22. Click Next.

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

  24. Click OK.

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

9.2.2 Creating an Invoke Activity

Summary:

This Invoke activity writes order acknowledgment data results into a file.
  1. Select Process Activities from the Component Palette section.

  2. Drag and drop an Invoke activity from the Component Palette section to below the transformPO Transform activity.

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

  4. Enter the following details:

    Field Value
    Name invokeFileOut
    Partner Link FileWrite

    The Operation (Write) field is automatically filled in.

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

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

  7. Click OK.

  8. Select Save from the File main menu.

9.2.3 Creating an Assign Activity

  1. Drag and drop an Assign activity from the Component Palette section to above the invokeFileOut Invoke activity.

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

  3. Click the General tab.

  4. Enter assignFileWriteIn 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 values:

    Field Value
    From
    • Type
    Variable
    • Variables
    Expand and select Variables > outputVariable > payload
    To
    • Type
    Variable
    • Variables
    Expand and select Variables > invokeFileOut_Write_InputVariable > POAcknowledge

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

  10. Select Save from the File main menu.

9.2.4 Deploying the POAcknowledge Service

  1. Go to the Application Navigator section.

  2. Right-click POAcknowledge.

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

9.2.5 Running and Verifying the POAcknowledge 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.

    The Dashboard tab of Oracle BPEL Control appears. Note that your BPEL process, POAcknowledge, now appears in the Deployed BPEL Processes list.

  3. Click POAcknowledge.

  4. Enter details in all fields of the HTML Form and click Post XML Message.

  5. Refresh Oracle BPEL Control.

  6. Click the Instances tab.

  7. Click the POAcknowledge instance.

  8. Click the Audit link to view the transformation logic.

  9. 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).

9.2.6 Creating a Partner Link

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.
  1. Expand the OrderBooking process in the Application Navigator section.

  2. Double-click OrderBooking.bpel.

  3. Select Services from the Component Palette section.

  4. Drag and drop a PartnerLink activity from the Component Palette section onto the right side of the designer window.

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

  6. Click OK.

  7. Select Save from the File main menu.

9.2.7 Creating a Scope Activity

Summary:

You now create a Scope activity to group all activities that form a logical step to be executed.
  1. Select Process Activities from the Component Palette section.

  2. Drag and drop a Scope activity from the Component Palette section to below the SelectSupplier Switch activity.

  3. Double-click the scope icon to display the Scope window.

  4. Enter WritePOAcknowledgment in the Name field of the General tab.

  5. Click OK.

    In this phase of the tutorial, you create the Invoke, Receive, and Assign activities inside this Scope activity.

  6. Click the + sign to expand the Scope activity.

  7. Select Save from the File main menu.

9.2.8 Creating Invoke and Receive Activities

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.
  1. Drag and drop an Invoke activity from the Component Palette section to inside the WritePOAcknowledgment Scope activity.

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

  3. Enter the following details:

    Field Value
    Name invokeFileWrite
    Partner Link WritePOA

    The Operation (initiate) field is automatically filled in.

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

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

  6. Click OK.

  7. Drag and drop a Receive activity from the Component Palette section to below the invokeFileWrite Invoke activity inside the WritePOAcknowledgment Scope activity.

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

  9. Enter the following details:

    Field Value
    Name receiveFileWrite
    Partner Link WritePOA

    The Operation (onResult) field is automatically filled in.

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

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

  12. Click OK.

  13. Select Save from the File main menu.

9.2.9 Creating an Initial Assign Activity

  1. Drag and drop an Assign activity from the Component Palette section to above the invokeFileWrite Invoke activity inside the WritePOAcknowledgment Scope activity.

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

  3. Click the General tab.

  4. Enter assignFileWriteIn in the Name field.

  5. Click Apply.

  6. Click the Copy Operations tab.

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

  8. Enter the following values:

    Field Value
    From
    • Type
    Variable
    • Variables
    Expand and select Variables > inputVariable > payload
    To
    • Type
    Variable
    • Variables
    Expand and select Variables > invokeFileWrite_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.

9.2.10 Creating a Second Assign Activity

  1. Drag and drop an Assign activity from the Component Palette section to below the receiveFileWrite Receive activity inside the WritePOAcknowledgment Scope activity.

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

  3. Click the General tab.

  4. Enter assignFileWriteComments 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 values:

    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
    • Type
    Expression
    • Expression
    concat(bpws:getVariableData('inputVariable','payload','/ns1:PurchaseOrder/ns1:OrderInfo/ns1:OrderComments'), ' - Write POAck complete')
    To
    • Type
    Variable
    • Variables
    Expand and select Variables > inputVariable > payload > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderComments

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

    When complete, the designer window looks as follows:

    Description of obph8.gif follows
    Description of the illustration obph8.gif

  10. Click the - sign to close the WritePOAcknowledgment Scope activity.

  11. Select Save from the File main menu.

9.2.11 Validating, Compiling, and Deploying the Order Booking Process

  1. Go to the Application Navigator section.

  2. Right-click OrderBooking.

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

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

9.2.12 Running and Verifying the Order Booking 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

    The Dashboard tab of Oracle BPEL Control appears. Note that your BPEL processes, POAcknowledge and OrderBooking, appear in the Deployed BPEL Processes list.

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

      Note:

      Do not copy and paste from Internet Explorer. You must use a text editor to perform this task.
  4. 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.

  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. Refresh Oracle BPEL Control.

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

  9. Click the instance.

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

9.3 Summary

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: