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
 

7 Adding Transformation Logic

This chapter of the tutorial describes how to add transformation logic to a BPEL process.

This chapter contains the following topics:

7.1 Introduction

This phase of the tutorial adds to the process you designed in Chapter 6, "Creating Fault Handling and Exception Management". Ensure that you have successfully completed that phase before performing this one. In this phase of the tutorial, you add transformation logic to a new BPEL process. You perform the following key tasks:

7.2 Adding Transformation Logic

This section contains the following tasks:

7.2.1 Creating a POAcknowledge Project

You must create a POAcknowledge project.


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.

  1. Right-click OrderBookworkspace in the Applications Navigator section of the designer window.

  2. Select New Project.

  3. Double-click BPEL Process Project in the Items window to display the BPEL Process Project window.

  4. Enter POAcknowledge in the BPEL Process Name field. All other fields default to the correct values for creating an asynchronous BPEL process.

  5. Click OK.

    This creates the bpel.xml, POAcknowledge.bpel, and POAcknowledge.wsdl files in the Applications Navigator section of the designer window.

7.2.2 Importing Schema Files

  1. Copy OrderBookingPO.xsd and POAcknowledge.xsd from the Oracle_Home\integration\orabpel\samples\tutorials\127.OrderBookingTutorial\PracticeFiles directory to the Oracle_Home\integration\jdev\jdev\mywork\OrderBookworkspace\POAcknowledge directory.

  2. Double-click POAcknowledge.bpel in the Applications Navigator section of the designer window to display the Structure section in the lower left section of JDeveloper BPEL Designer.

  3. Select and right-click Project Schemas in the Structure section of the designer window.

  4. Select Import Schema.

    The Import Schema window appears.

  5. Click the flashlight icon to access the Open window.

  6. Select OrderBookingPO.xsd from the POAcknowledge directory in which you placed it in Step 1 and click Open.

    The file is added to the URL field of the Import Schema window.

  7. Click OK.

  8. Verify that OrderBookingPO.xsd appears under POAcknowledge > Web Content > Miscellaneous Files in the Applications Navigator section of the designer window. OrderBookingPO.xsd also appears under Project Schemas in the Structure section.

  9. Select Save from the File main menu.

  10. Expand Message Types > Process WSDL - POAcknowledge.wsdl > POAcknowledgeRequestMessage > payload in the Structure section.

  11. Right-click payload and select Edit Message Part to display the Edit Message Part window.

  12. Select Element and click the flashlight icon to the right of the Element field.

  13. Expand Project Schema Files > OrderBookingPO.xsd.

  14. Select PurchaseOrder.

  15. Click OK to close the Type Chooser window and the Edit Message Part window.

    This defines the input parameter (payload) of the PurchaseOrder type.

  16. Select and right-click Project Schemas in the Structure section of the designer window.

  17. Select Import Schema.

    The Import Schema window appears.

  18. Click the flashlight icon to access the Open window.

  19. Select POAcknowledge.xsd from the POAcknowledge directory in which you placed it in Step 1 and click Open.

    The file is added to the URL field of the Import Schema window.

  20. Click OK.

  21. Verify that POAcknowledge.xsd appears under POAcknowledge > Web Content > Miscellaneous Files in the Applications Navigator section of the designer window. POAcknowledge.xsd also appears under Project Schemas in the Structure section.

  22. Select Save from the File main menu.

  23. Expand Message Types > Process WSDL - POAcknowledge.wsdl > POAcknowledgeResponseMessage > payload in the Structure section.

  24. Right-click payload and select Edit Message Part to display the Edit Message Part window.

  25. Select Element and click the flashlight icon to the right of the Element field.

  26. Expand Project Schema Files > POAcknowledge.xsd.

  27. Select POAcknowledge.

  28. Click OK to close the Type Chooser window and the Edit Message Part window.

  29. Select Save from the File main menu.

7.2.3 Creating a Transform Activity


Summary:

You now use a Transform activity to create a transformation that maps incoming purchase order data into outgoing purchase order acknowledgement data.

  1. Drag and drop a Transform activity between the receiveInput Receive activity and the callbackClient Invoke activity.

  2. Double-click the Transform activity.

  3. Click the General tab.

  4. Enter transformPO in the Name field.

  5. Click the Transformation tab to display the Transformation window.

  6. Select inputVariable in the Source Variable field (this automatically selects payload in the Source Part field).

  7. Select outputVariable in the Target Variable field (this automatically selects payload in the Target Part field).

  8. Leave the Mapper File field selection as Transformation_1.

  9. Click the second icon (the Create Mapping icon) to the right of the Mapper File field.

    Description of create_mapping.gif follows
    Description of the illustration create_mapping.gif

    A window for graphically mapping source and target elements appears. This window enables you to drag (map) a source element to a target element. If you instead receive a message saying the file already exists, click the third icon to access the transformation window.

  10. Right-click the source and target schemas (the top-most elements in both lists) and select Expand All.

    Description of obph6trans1.gif follows
    Description of the illustration obph6trans1.gif

  11. Drag and drop the following source elements to the following target elements. As you perform this task, a line connects each source to its target.


    Note:

    The namespace values that appear for the source (for example, ns1, po) can vary. Use the namespace values that automatically appear.

    Drag the Source... To the Target...
    po:CustID CustomerID
    po:ID ID
    po:ShipTo ShippingAddress

    Note: Click OK when prompted to confirm your mapping. Connecting this source and target automatically connects all subelements.


    The Transformation window appears as follows:

    Description of obph6trans2.gif follows
    Description of the illustration obph6trans2.gif


    Note:

    If you drag and drop a source element to the wrong target element, right-click the connecting line and select Delete.

  12. Select String Functions from the Component Palette section.

  13. Drag and drop a concat function into the middle of the transformation window.

  14. Go to the po:ShipTo > po:Name source section.

  15. Drag the po:First and po:Last source elements below po:ShipTo > po:Name into the concat function. This connects two source lines to the concat function.

  16. Go to the ShippingAddress target section.

  17. Drag the Name target element into the concat function. This connects the target line to the concat function and concatenates the first and last names from the source elements into a single name in the target element.

    Description of obph6trans3.gif follows
    Description of the illustration obph6trans3.gif

  18. Drag and drop another concat function into the middle of the transformation window to map source BillTo to target BillingAddress.

  19. Go to the po:BillTo > po:Name source section.

  20. Drag the po:First and po:Last source elements below po:BillTo > po:Name into the concat function. This connects two source lines to the concat function.

  21. Go to the BillingAddress target section.

  22. Drag the Name target element into the concat function. This connects the target line to the concat function and concatenates the first and last names from the source elements into a single name in the target element.

    Description of obph6trans5.gif follows
    Description of the illustration obph6trans5.gif

  23. Select and right-click the target Items. This displays a list of XSL functions.

  24. Select Add XSL Node > for-each.

    The for-each node appears above the target Items.

  25. Go to the source po:OrderItems section.

  26. Drag and drop the source po:Item onto the for-each link.

  27. Drag and drop the source po:Item onto the target Items (below the for-each link).

  28. Click OK when prompted to confirm your mapping. This automatically maps all subelements.

    Description of obph6trans7.gif follows
    Description of the illustration obph6trans7.gif

    This defines a relationship that specifies a one-to-many (1:M) mapping between the source and target.

  29. Drag and drop the remaining source purchase order elements to the target purchase order acknowledge elements:

    Drag the Source... To the Target...
    po:SupplierPrice SupplierPrice
    po:SupplierName SupplierName
    po:OrderDate OrderDate
    po:OrderPrice OrderPrice
    po:OrderStatus OrderStatus

    Description of obph6trans8.gif follows
    Description of the illustration obph6trans8.gif

  30. Select Save from the File main menu.

7.2.4 Testing the Transformation Logic

  1. Right-click in the transformation mapping window and select Test.

    This displays the Test XSL Map window.

  2. Select Generate to create sample XML test data.

    Test data appears in the upper left corner in the Source XML section.

  3. Click Test at the bottom right to test the translation logic.

    Sample test results appear in the upper right corner in the Target XML section.

    Description of obph6test.gif follows
    Description of the illustration obph6test.gif

  4. Verify the results.

  5. Click Close to close the test window.

  6. Click Yes if prompted to save your transformation details.

  7. Close the Transformation window by clicking the x button on the Title tab.

    Description of obph9trans7.gif follows
    Description of the illustration obph9trans7.gif

    A translation file named Transformation_1.xsl appears under POAcknowledge > Integration Content in the Applications Navigator section.

7.3 Summary

You have now added transformation logic to a BPEL process. You performed the following key tasks: