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
 

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 Applications Navigator section of the designer window.

  2. Double-click POAcknowledge.bpel.

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

  4. Enter FileOutbound in the Name field.

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

  6. Click Next on the Welcome window.

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

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

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

  10. Select Directory Specified as Physical Path.

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

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

  13. Click Select.

  14. Enter po_%yyMMddHHmmss%.xml in the File Naming Convention field.

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

  16. Click Browse next to the Schema File URL field on the Messages window.

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

  18. Click OK.

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

  19. Click Next.

  20. Click Finish.

    You are returned to the Partner Link window. All other fields are automatically completed. The window looks as follows:

    Field Value
    Name FileOutbound
    WSDL File file:/c:/oraBPEL/integration/jdev/jdev/mywork/OrderBookworkspace/POAcknowledge/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.

    Partner Link Type Write_plt
    My Role Leave unspecified.
    Partner Role Write_role

  21. Click OK.

  22. Select Save from the File main menu.

    Note that FileWrite.wsdl now appears under POAcknowledge > Integration Content. 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. Drag and drop an Invoke activity from the Component Palette section to below the transformPO Transform activity.

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

  3. Enter the following details:

    Field Value
    Name invokeFileOut
    Partner Link FileOutbound

    The Operation (Write) 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 invokeFileOut_write_InputVariable is automatically created in the Input Variable field. This variable is automatically assigned a message type of FileWritePOAcknowledge_msg.

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

  7. Click Create to display the Create Copy Rule 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 Rule window and the Assign window.

  10. Select Save from the File main menu.

9.2.4 Deploying the POAcknowledge Service

  1. Go to the Applications Navigator section.

  2. Right-click POAcknowledge.

  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.

9.2.5 Running and Verifying the POAcknowledge 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, POAcknowledge, now appears in the Deployed BPEL Processes list.

  2. Click POAcknowledge.

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

  4. Refresh Oracle BPEL Console.

  5. Click the Instances tab.

  6. Click the POAcknowledge instance.

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

  8. View the output file written in the directory you selected in Step 12 (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 Applications Navigator section.

  2. Double-click OrderBooking.bpel.

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

  4. 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 WSIL Browser) to access the WSDL Chooser window for automatically selecting a purchase order acknowledgment service.

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

    http://localhost:9700/orabpel/default/POAcknowledge/POAcknowledge?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 POAcknowledge
    My Role POAcknowledgeRequester
    Partner Role POAcknowledgeProvider

  5. Click OK.

  6. 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. Drag and drop a Scope activity from the Component Palette section to below the SelectSupplier Switch activity.

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

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

  4. Click OK.

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

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

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

  7. Click Create to display the Create Copy Rule 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 Rule 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 Rules tab.

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

  2. Right-click OrderBooking.

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

  4. Enter the domain password of bpel when prompted.

  5. Increment the version number of the project when prompted and click OK (for example, enter 1.5).

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

9.2.12 Running and Verifying the Order Booking 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 processes, POAcknowledge and OrderBooking, appear in the Deployed BPEL Processes list.

  2. Click the BPEL Processes tab.

  3. Note which OrderBooking version has an asterisk next to the version number. This is the default version.

  4. Click the latest version number of the OrderBooking process. If you have been incrementing the version numbers as described in previous chapters, this is the highest number.

    The Managing this BPEL Process window appears.

  5. Scroll down and click Mark as Default to make this the default version of OrderBooking.

  6. Click Done when prompted and note that this OrderBooking version now has an asterisk next to the version number, indicating that it is the default version.

  7. If you have installed Patch 1, go to Step 8. Otherwise, you must first perform Steps 7a through 7c. See Chapter 1, "Introduction" for information about where to obtain Patch 1.

    1. Click Clear WSDL Cache under Related Tasks in the lower-left section.

    2. Click Back to Processes when prompted.

    3. Go to Step 8.

  8. Click the Dashboard tab.

  9. Click the OrderBooking instance version you increased in Step 5 and start it in one of the following ways:

    • Open the provided CreateOrderBookingUI application at http://localhost:9700/CreateOrderBookingUI and provide inputs to initiate a process.

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

    • Select XML Source from the Initiating a test instance list. 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.

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

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

  12. Return to Oracle BPEL Console.

  13. Refresh Oracle BPEL Console.

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

  15. Click the instance.

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