SOA Tutorial
SOA Tutorial
September 2006
Oracle SOA Suite Tutorial, Release 3 (10.1.3.1.0) B28937-01 Copyright 2006 Oracle. All rights reserved. The Programs (which include both the software and documentation) contain proprietary information; they are provided under a license agreement containing restrictions on use and disclosure and are also protected by copyright, patent, and other intellectual and industrial property laws. Reverse engineering, disassembly, or decompilation of the Programs, except to the extent required to obtain interoperability with other independently created software or as specified by law, is prohibited. The information contained in this document is subject to change without notice. If you find any problems in the documentation, please report them to us in writing. This document is not warranted to be error-free. Except as may be expressly permitted in your license agreement for these Programs, no part of these Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose. If the Programs are delivered to the United States Government or anyone licensing or using the Programs on behalf of the United States Government, the following notice is applicable: U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the Programs, including documentation and technical data, shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement, and, to the extent applicable, the additional rights set forth in FAR 52.227-19, Commercial Computer SoftwareRestricted Rights (June 1987). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065 The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup, redundancy and other measures to ensure the safe use of such applications if the Programs are used for such purposes, and we disclaim liability for any damages caused by such use of the Programs. Oracle, JD Edwards, and PeopleSoft are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. The Programs may provide links to Web sites and access to content, products, and services from third parties. Oracle is not responsible for the availability of, or any content provided on, third-party Web sites. You bear all risks associated with the use of such content. If you choose to purchase any products or services from a third party, the relationship is directly between you and the third party. Oracle is not responsible for: (a) the quality of third-party products or services; or (b) fulfilling any of the terms of the agreement with the third party, including delivery of products or services and warranty obligations related to purchased products or services. Oracle is not responsible for any loss or damage of any sort that you may incur from dealing with any third party.
Contents
Preface ................................................................................................................................................................. xi
Audience....................................................................................................................................................... xi Documentation Accessibility ..................................................................................................................... xi Related Documents .................................................................................................................................... xii Conventions ................................................................................................................................................ xii
3.4 3.5 3.6 3.7 3.8 3.9 3.9.1 3.9.2 3.9.3 3.10 3.11 3.12 3.13
Edit persistence.xml.................................................................................................................... 3-7 Create a Session Bean in the business Directory .................................................................... 3-9 Define Additional Queries in Customer.java ...................................................................... 3-13 Use a Database Sequence to Generate Address IDs in Address.java............................... 3-16 Edit Session Facade for the Session Bean (CustomerServiceBean.java)........................... 3-16 Add and Modify Methods in the Session Bean (CustomerServiceBean.java) ................ 3-17 Modify queryCustomerFindCustomerById ................................................................. 3-17 Modify queryCustomerFindCustomerByEmail........................................................... 3-19 Add getCustomerStatus and addNewCustomer Methods ........................................ 3-21 Add JSR-181 Annotations to the Web Service Endpoint Interface (CustomerService.java) .... 3-22 Create EJB JAR Deployment Profile for the CustomerService Project............................. 3-23 Deploy CustomerService ........................................................................................................ 3-25 View the WSDL for CustomerService................................................................................... 3-26
iv
Prepare the Order ID and Order Status Information ("AssignOrderStatus" Assign Activity) 8-31 8.7.6 Create the Mapping File ("TransformOrder" BPEL Service) ...................................... 8-34 8.7.7 Insert the Order Information into the Database ("InsertOrder" Invoke Activity)... 8-36 8.7.8 Minimize the "InsertOrderIntoDB" Scope..................................................................... 8-39 8.8 Retrieve Information About the Customer ("CustomerService" Scope) .......................... 8-39 8.8.1 Create the "CustomerService" Partner Link.................................................................. 8-40 8.8.2 Create the "CustomerService" Scope.............................................................................. 8-42 8.8.3 Assign Customer ID to the findCustomerById Operation ("AssignRequest" Assign Activity) 8-43 8.8.4 Create a Variable to Contain the Results of findCustomerById ("customerServiceResponse" Process Variable) 8-45 8.8.5 Invoke findCustomerById ("GetCustInfo" Invoke Activity) ...................................... 8-47 8.8.6 Create the "AssignInitialCustomerResponse" Assign Activity.................................. 8-49 8.8.7 Copy the Customers First and Last Names to the inputVariable ("AssignCustomerResponse" Assign Activity) 8-52 8.8.8 Minimize the "CustomerService" Scope ........................................................................ 8-54 8.9 Verify the Customers Credit Card ("CreditService" Scope) ............................................. 8-54 8.9.1 Create "CreditValidatingService" Partner Link............................................................ 8-55 8.9.2 Create the "CreditService" Scope.................................................................................... 8-57 8.9.3 Assign the Credit Card Number and Credit Card Type Information ("InitializeRequest" Assign Activity) 8-60 8.9.4 Verify the Customers Credit Card ("InvokeCreditService" Invoke Activity)......... 8-62 8.9.5 Create the "OrderBookingFault" Process Variable ...................................................... 8-65 8.9.6 Check the Results of the Credit Card Validation (Switch Activity) .......................... 8-67 8.9.6.1 Specify the Condition for <case> ............................................................................ 8-67 8.9.6.2 Set the Value of the OrderBookingFault Variable ("AssignFault" Assign Activity)... 8-68 8.9.6.3 Create the "ThrowCreditFault" Throw Activity.................................................... 8-70 8.9.7 Minimize the "CreditService" Scope .............................................................................. 8-70 8.10 Set up Oracle Business Rules.................................................................................................. 8-70 8.10.1 Set up the Repository File................................................................................................ 8-71 8.10.2 Create a Dictionary in the Repository............................................................................ 8-72 8.10.3 Copy OrderBookingRules.xsd to the Oracle Application Server Machine.............. 8-73 8.10.4 Generate JAXB Classes for the Elements in the XML Schema ................................... 8-74 8.10.5 Import the JAXB Classes into the Oracle Business Rules Data Model...................... 8-76 8.10.6 Define a Variable in the Data Model.............................................................................. 8-77 8.10.7 Create a Ruleset................................................................................................................. 8-78 8.10.8 Create Rules....................................................................................................................... 8-79 8.10.8.1 Create the "belowLimit" Rule .................................................................................. 8-79 8.10.8.2 Create the "overLimit" Rule ..................................................................................... 8-82 8.10.8.3 Create the "platinumMember" Rule........................................................................ 8-86 8.10.9 Log out of Rule Author .................................................................................................... 8-89 8.10.10 Copy the Files to the JDeveloper Machine.................................................................... 8-89 8.11 Determine If an Order Requires Manual Approval ("RequiresManualApproval" Decide Activity) 8-89 8.11.1 Create the Activities in the "RequiresManualApproval" Decide Activity ............... 8-90 8.11.2 Copy Order Total and Customer Status Information ("BPEL_Var_To_Rule_Facts" Assign Activity) 8-94 8.7.5
vi
Copy the ConversationId to the dsIn Variable ("BPEL_Header" Assign Activity). 8-98 Create the "requiresApproval" Process Variable ......................................................... 8-99 Copy the Result of the Decision Service to the requiresApproval Variable ("Facts_To_ BPEL_Var" Assign Activity) 8-100 8.11.6 Minimize the "RequiresManualApproval" Decide Activity..................................... 8-102 8.12 Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch) 8-102 8.12.1 Create the Switch ............................................................................................................ 8-104 8.12.2 Set the Condition for the <case>................................................................................... 8-104 8.12.3 Create a Sequence in the <case> Branch ..................................................................... 8-106 8.12.4 Create a Human Task..................................................................................................... 8-106 8.12.5 Create a Form for the Worklist Application ............................................................... 8-111 8.12.6 Accept the Default Settings for the Remaining Human Task Activities ................ 8-111 8.13 Handle the Managers Response ("requiresApproval" Switch) ...................................... 8-112 8.13.1 Handle the Reject Case................................................................................................... 8-112 8.13.1.1 Set the Status of the Order (Assign Activity) ...................................................... 8-112 8.13.1.2 Create a Throw Activity ......................................................................................... 8-113 8.13.2 Handle the Approve Case ............................................................................................. 8-114 8.13.3 Handle the Expired Case ............................................................................................... 8-114 8.13.4 Accept the Default Settings for Each Case .................................................................. 8-114 8.13.5 Minimize the "requiresApproval" Switch ................................................................... 8-114 8.14 Choose a Supplier ("SelectSupplier" Scope)....................................................................... 8-115 8.14.1 Create the "SelectManufacturer" Partner Link ........................................................... 8-116 8.14.2 Create the "RapidService" Partner Link....................................................................... 8-118 8.14.3 Create the "SelectSupplier" Scope ................................................................................ 8-119 8.14.4 Create a Flow Activity ................................................................................................... 8-122 8.14.5 Set the Activities for Select Manufacturer................................................................... 8-122 8.14.5.1 Create a Scope for SelectManufacturer ................................................................ 8-122 8.14.5.2 Create a Transform Activity ("TransformSelectRequest" Transform Activity) ........... 8-125 8.14.5.3 Create an Invoke Activity....................................................................................... 8-126 8.14.5.4 Create a Receive Activity........................................................................................ 8-128 8.14.6 Set the Activities for Rapid Manufacturer .................................................................. 8-130 8.14.6.1 Create a Scope for Rapid Manufacturer............................................................... 8-131 8.14.6.2 Create a Transform Activity ("TransformRapidRequest" Transform Activity) .......... 8-132 8.14.6.3 Create an Invoke Activity....................................................................................... 8-134 8.14.7 Create a Switch to Pick the Lower-Priced Quote ....................................................... 8-137 8.14.7.1 Create the Switch ..................................................................................................... 8-137 8.14.7.2 Set the Condition for the Switch............................................................................ 8-137 8.14.7.3 Set the Activities for Select Manufacturer............................................................ 8-140 8.14.7.4 Set the Activities for Rapid Distributor................................................................ 8-142 8.14.8 Minimize the "SelectSupplier" Scope ........................................................................... 8-144 8.15 Determine the Shipping Method ("PostFulfillmentReq" Scope) ..................................... 8-145 8.15.1 Create the "OrderFulfillment" Partner Link................................................................ 8-145 8.15.2 Create the "PostFulfillmentReq" Scope........................................................................ 8-147 8.15.3 Copy Order Information to Scope Variable ("initializeRequest" Assign Activity) 8-149 8.15.4 Invoke OrderFulfillmentESB ("PostFulfillmentReq" Invoke Activity) ................... 8-150 8.11.3 8.11.4 8.11.5
vii
8.15.5 Create a Catch-All Branch for the Scope ..................................................................... 8-152 8.15.6 Minimize the "PostFulfillmentReq" Scope .................................................................. 8-153 8.16 Set the Order Status to "Completed" ("SetFinalOrderStatus" Scope) ............................. 8-153 8.16.1 Create the "OrderStatus" Database Adapter............................................................... 8-154 8.16.2 Create the "SetFinalOrderStatus" Scope ...................................................................... 8-157 8.16.3 Prepare the Order ID and Status ("AssignOrderStatus" Assign Activity) ............. 8-159 8.16.4 Update the Order Status in the Database ("UpdateOrderStatus" Invoke Activity) ........... 8-161 8.16.5 Minimize the "SetFinalOrderStatus" Scope................................................................. 8-163 8.17 Send an Email Notification to the Customer ("NotifyCustomer" Scope) ...................... 8-164 8.17.1 Create the Notification Scope........................................................................................ 8-164 8.17.2 Minimize the "Email_1" Scope ...................................................................................... 8-168 8.17.3 Rename the "Email_1" Scope......................................................................................... 8-168 8.18 Call Back the Client ("callbackClient" Invoke Activity) ................................................... 8-168 8.18.1 Create the Invoke Activity............................................................................................. 8-168 8.18.2 Add a Sensor ................................................................................................................... 8-170 8.19 Add a Catch Branch to the Project....................................................................................... 8-174 8.19.1 Add a "client:OrderBookingFault" Catch.................................................................... 8-175 8.19.2 Create a Sequence ........................................................................................................... 8-177 8.19.3 Create a Scope ................................................................................................................. 8-177 8.19.4 Create the Assign Activity............................................................................................. 8-179 8.19.5 Create the Invoke Activity............................................................................................. 8-182 8.19.6 Create a Sensor in the Invoke Activity ........................................................................ 8-184 8.20 Deploy the Project.................................................................................................................. 8-188 8.20.1 Deploying Using Ant from the Developer Prompt ................................................... 8-190 8.20.2 Viewing SOAOrderBooking in the Oracle BPEL Control......................................... 8-190
10
Interfacing the Client Application with the SOA Order Booking Application
10.1 About the SOADemo-Client Application............................................................................. 10.2 Invoking Services from CustomerService ............................................................................ 10.2.1 Generate a Web Service Proxy for CustomerService................................................... 10.2.2 Build the Files .................................................................................................................... 10.2.3 Write Code to Invoke the Web Service Proxy for CustomerService ......................... 10.2.3.1 Verifying the Login ................................................................................................... 10.2.3.2 Registering New Customers .................................................................................... 10.3 Invoking the OrderBookingESB Project ............................................................................... 10.3.1 Retrieve the Concrete WSDL URL ................................................................................. 10-1 10-2 10-2 10-6 10-7 10-7 10-8 10-9 10-9
viii
10.3.2 Create the Project in the Client and Create the Web Service Proxy ........................ 10.3.3 Build the Files .................................................................................................................. 10.3.4 Write Code to Invoke the Web Service Proxy for OrderBookingESB..................... 10.4 Deploying the Client Application .......................................................................................
ix
Preface
This document describes how to build the SOA Order Booking demo application. This preface contains the following topics:
Audience
This document is intended for developers who are interested in developing applications based on service-oriented architecture (SOA).
Documentation Accessibility
Our goal is to make Oracle products, services, and supporting documentation accessible, with good usability, to the disabled community. To that end, our documentation includes features that make information available to users of assistive technology. This documentation is available in HTML format, and contains markup to facilitate access by the disabled community. Accessibility standards will continue to evolve over time, and Oracle is actively engaged with other market-leading technology vendors to address technical obstacles so that our documentation can be accessible to all of our customers. For more information, visit the Oracle Accessibility Program Web site at http://www.oracle.com/accessibility/ Accessibility of Code Examples in Documentation Screen readers may not always correctly read the code examples in this document. The conventions for writing code require that closing braces should appear on an otherwise empty line; however, some screen readers may not always read a line of text that consists solely of a bracket or brace. Accessibility of Links to External Web Sites in Documentation This documentation may contain links to Web sites of other companies or organizations that Oracle does not own or control. Oracle neither evaluates nor makes any representations regarding the accessibility of these Web sites.
xi
TTY Access to Oracle Support Services Oracle provides dedicated Text Telephone (TTY) access to Oracle Support Services within the United States of America 24 hours a day, seven days a week. For TTY support, call 800.446.2398.
Related Documents
For more information related to the demo application, see the following documents in the Oracle Application Server Release 3 (10.1.3.1.0) documentation set:
Oracle SOA Suite Quick Start Guide Oracle SOA Suite Developers Guide
Conventions
The following text conventions are used in this document:
Convention boldface italic monospace Meaning Boldface type indicates graphical user interface elements associated with an action, or terms defined in text or the glossary. Italic type indicates book titles, emphasis, or placeholder variables for which you supply particular values. Monospace type indicates commands within a paragraph, URLs, code in examples, text that appears on the screen, or text that you enter.
xii
1
Introduction to the SOA Order Booking Application and the Tutorial
This chapter describes the components of the SOA Order Booking application, and the requirements for creating and running it. This chapter contains the following sections:
Section 1.1, "What Does the SOA Order Booking Application Do?" Section 1.2, "Flow of the Application" Section 1.3, "Software Required for Creating and Running the Application" Section 1.4, "Contents of the SOADEMO Schema" Section 1.5, "How This Tutorial Is Organized" Section 1.6, "Technologies and Techniques Used in Each Project"
Projects that provide services. These projects include CustomerService, CreditService, SelectManufacturer, and RapidService. The services offered by these
Introduction to the SOA Order Booking Application and the Tutorial 1-1
projects are implemented as web services so that they can be invoked by different types of clients. For example, the CustomerService project is invoked by the SOADemo-Client application and also by the SOAOrderBooking BPEL project.
Projects that define the flow of action in the application. These projects use the ESB (Enterprise Service Bus) or the BPEL technologies. These projects include OrderBookingESB, FulfillmentESB, and SOAOrderBooking, and they invoke the projects that provide services. They can also invoke other BPEL and ESB project. For example, the OrderBookingESB project invokes the SOAOrderBooking project (which is a BPEL project), and the SOAOrderBooking project invokes the FulfillmentESB project.
Table 11 provides a short description of the projects in the SOA Order Booking application.
Table 11 Project OrderBookingESB Projects in the SOA Order Booking Application Description Provides the starting point for the SOA Order Booking application. The SOADemo-Client application invokes OrderBookingESB, which invokes SOAOrderBooking, which invokes everything else. Defines the main flow of the application. It invokes all the web services and performs the appropriate actions based on the results. Provides web services for looking up existing customers in the database, and for adding new customers. Provides web services for checking whether or not a customers credit card is valid. Provides price quote for orders. This is one of the suppliers. Provides price quote for orders. This is another supplier. Determines how an order is to be shipped based on the dollar amount of the order.
SOAOrderBooking
In addition to the SOA Order Booking application and its projects, this tutorial also describes the SOADemo-Client application, which is the web front-end to the SOA Order Booking application.
When a customer places an order using the SOADemo-Client application, this action invokes the OrderBookingESB project. The OrderBookingESB project invokes the SOAOrderBooking project, which defines the main flow of the SOA Order Booking application. The SOAOrderBooking project inserts the order information in the database. The SOAOrderBooking project retrieves customer information from the database. It does this by invoking the CustomerService project. The SOAOrderBooking project checks the customers credit. It does this by invoking the CreditService project.
1-2
6.
The SOAOrderBooking project then determines if the order requires manual approval. It does this by using the rules defined in a rules repository. The application uses these rules:
If the customers status is platinum, then the order is approved automatically, regardless of the dollar amount of the order. For non-platinum customers, if the dollar amount of the order is greater than or equal to $1000, then the order requires manual approval. If the order is under $1000, then the order is approved automatically.
7. 8. 9.
For orders that require manual approval, a manager needs to log into the Worklist application and approve (or reject) the order. For approved orders, the SOAOrderBooking project requests quotes from the suppliers: SelectManufacturer and RapidService. After getting responses from the suppliers, the SOAOrderBooking project selects the supplier that responded with the lower quote. order. It does this by invoking the FulfillmentESB project.
10. The SOAOrderBooking project selects a shipping method (USPS or Fedex) for the 11. The FulfillmentESB project checks the dollar amount of the order. If the amount is
under $500, then it selects the USPS as the shipper. Otherwise, Fedex is the shipper.
12. The SOAOrderBooking project sets the order status in the database. 13. The SOAOrderBooking project sends an email to the customer. It does this through
Oracle Database
1-3
Tables in the SOADEMO Schema Description Stores the addresses of the customers. Stores customer data. Is a mapping table between customers and addresses. A customer can have more than one address. Stores order information. Stores the items in orders. Stores items available for purchase. Stores order information for orders that are shipped by Fedex. Stores customer ID and social security number. This table is used only to show how to add a feature to the SOA Order Booking application. See the Oracle SOA Suite Quick Start Guide for details. Is used internally by Enterprise JavaBeans.
EJB_TAB_ID_GEN
1-4
Running in a Multi-Lingual or Multibyte Environment If you are running the Oracle BPEL Process Manager in a multi-lingual environment or need multibyte support, it is recommended that your database character set encoding be Unicode. This means that the database character set encoding should be AL32UTF8. If the character set encoding is not Unicode, there may be possible loss or misinterpretation of data.
Uses EJB 3.0 entity objects that are generated from database tables. JDeveloper is used to generate the entity objects. Uses JSR-181 Web Services Metadata annotations. Uses a stateless session bean as the session facade. The session bean is generated by JDeveloper. Shows "top-down" implementation of web services: starting with a WSDL file, you use JDeveloper to generate Java classes from the WSDL file. Shows "bottom-up" implementation of web services: starting with Java classes, you use JDeveloper to generate a WSDL file. Uses JSR-181 Web Services Metadata annotations in the Java files. Shows a simple asynchronous BPEL process with Receive and Invoke activities.
CreditService
RapidService
SelectManufacturer
1-5
Table 15 (Cont.) Technology and Techniques Used in the Projects Project FulfillmentESB Technology and Techniques Used
Shows routing services that use filters to check input data. The filters then direct the requests to the appropriate targets. Uses transformation rules to transform data appropriately for writing to databases and files. Database adapters and file adapters perform the writes. Shows a routing service that routes to a JMS adapter. Shows how to use BPEL to orchestrate a flow sequence. Invokes the services provided by all the projects (except for OrderBookingESB). Invokes other BPEL flows (the SelectManufacturer BPEL project). Invokes ESB project (the FulfillmentESB project). Shows how to integrate Oracle Business Rules with BPEL. Shows Decision Service. Sends email through the Email service. Uses the flow activity to send requests to RapidService and SelectManufacturer. Uses the human task to set up a step that requires manual approval. Invokes a BPEL project (the SOAOrderBooking project) by using a SOAP service. Shows how to invoke an ESB project from an ADF application (the "place order" button invokes the OrderBookingESB project). Shows how to call the CustomerService project from the "login" button.
SOAOrderBooking
1-6
2
Setting Up Your Environment
This chapter describes how to set up the required software for creating and running the SOA Order Booking application. This chapter contains the following sections:
Section 2.1, "Download the Files for the Tutorial" Section 2.2, "Install Oracle Application Server" Section 2.3, "Install Oracle JDeveloper" Section 2.4, "Unzip the Files for the SOA Order Booking Application" Section 2.5, "Install the SOADEMO Schema" Section 2.6, "Define Data Source and Connection Pool in Oracle Application Server" Section 2.7, "Set Up Connections in Oracle JDeveloper" Section 2.8, "Create the SOADEMO Application in JDeveloper"
Oracle Application Server. This is your runtime environment. JDeveloper. This is your development environment. SOA Order Booking demo application. This is the application that this tutorial describes. The zip file that contains the files for the application is soademo_ 101310_prod.zip.
You can download the files from the Service-Oriented Architecture page on the Oracle Technology Network site (http://www.oracle.com/technology/soa).
If your installation uses a different port number, you need to change the port number in some files. These files will be pointed out as you develop the application. Remember the password that you set for the oc4jadmin user. You will need this password for managing Oracle Application Server. For details on installing Oracle Application Server, see the Oracle Application Server Installation Guide for your platform.
2.4 Unzip the Files for the SOA Order Booking Application
Unzip the soademo_101310_prod.zip file that you downloaded for the SOA Order Booking application. You can unzip the files into a temporary directory. When you create the application, you will create the files for the application in a different directory. You will copy some files from the temporary directory to the application directory when you develop the SOA Order Booking application. For example, you can unzip the files into C:\temp, and you can build your application in C:\soademo.
9i, 10g, or XE. If you want to install the schema on an Oracle Lite database, you need to modify the SQL scripts that install the SOADEMO schema and its objects. To install the SOADEMO schema:
1. 2.
Change directory to where you unzipped the soademo_101310_prod.zip file for the SOA Order Booking application. Check that the directory contains the following files:
3. 4.
Check that the ORACLE_HOME and ORACLE_SID environment variables are set. Run build.sql as DBA using SQL*Plus:
2-2
The script creates a schema called SOADEMO with "ORACLE" as its password, and populates it with the tables described in Section 1.4, "Contents of the SOADEMO Schema".
2.6 Define Data Source and Connection Pool in Oracle Application Server
You need to define data sources and connection pools in Oracle Application Server so that the SOA Order Booking application will be able to access the database during runtime.
Log into Application Server Control. Click the home link to display the OC4J:home page. On the OC4J:home page, click the Administration tab. Click the icon in the Go To Task column for Services > JDBC Resources. See Figure 21 below. This displays the JDBC Resources page.
2-3
5.
In the JDBC Resources page, click the Create button in the Connection Pools section (not in the Data Sources section). This displays the Create Connection Pool Application page (Figure 22).
2-4
6. 7.
Click Continue to accept the defaults on the Create Connection Pool - Application page. This displays the Create Connection Pool page. On the Create Connection Pool page, set the following values:
Name: enter soademo_pool. URL section: enter the information to connect to the database where you installed the SOADEMO schema. Credentials section: enter the username and password to connect to the database.
2-5
8.
Click Test Connection. This displays the Test Connection page. Click Test on that page to verify that the connection information is valid. If the test failed, verify the connection values and try again. Click Finish. Continue with the next section to create a data source that uses the connection pool that you just created.
9.
2-6
On the JDBC Resources pages, click the Create button in the Data Sources section. This displays the Create Data Source - Application & Type page.
2. 3.
Click Continue on the Create Data Source - Application & Type page to accept the default values. This displays the Create Data Source - Managed Data Source page. On the Create Data Source - Managed Data Source page, enter the following values:
Name: enter soademoDS. JNDI Location: enter jdbc/soademoDS. Connection Pool: select soademo_pool.
2-7
4. 5.
Click Finish. This takes you back to the JDBC Resources page. On the JDBC Resources page, click the icon in the Test Connection column for the soademoDS data source. This displays the Test Connection page. Click Test on the Test Connection page. You should get a confirmation message that the connection was made successfully.
Click the OC4J:home breadcrumb link at the top of the page. Click the Applications link. Click the default link in the applications table. Click DbAdapter in the Modules table. Click the Connection Factories link. In the Connection Factories section, click the Create button. (Note: do not click the Create button in the Shared Connection Pools section.) On the Create Connection Factory: Select Interface page, click Continue to accept the default values. On the Create Connection Factory page, enter the following values:
2-8
9.
Click Finish.
Navigate to the directory where you installed Oracle JDeveloper and double-click the jdeveloper.exe executable. If this is the first time Oracle JDeveloper is run, a window asking "Do you wish to migrate?" appears.
2.
Click No to continue. You will build the entire application from scratch.
You can use a different name if you want, but using the same naming conventions will make it easier to follow the instructions.
2-9
1. 2. 3. 4.
In Oracle JDeveloper, select View > Connection Navigator. Right-click the Database node and select New Database Connection. Click Next on the Welcome page. In Step 1, Type, enter the following values:
Click Next.
5.
Username: enter SOADEMO. Password: enter oracle. Role: leave blank. Deploy Password: select the check box.
Click Next.
6.
Driver: select thin. Host Name: enter the name of the machine running the database where you installed the SOADEMO schema. JDBC Port: enter the port number for the database. The default value is 1521. SID: enter the system identifier for the database. The default value is ORCL.
If you are unsure about the database connection values, check with your database administrator. Click Next.
7.
In Step 4, Test, click Test Connection. If the test is not successful, check that the database is available and that the connection values are correct. You can click the Back button to return to the previous page to edit the connection values. Click Finish. The connection appears below the Database node in the Connection Navigator. You can now examine the schema from Oracle JDeveloper. In the Connection Navigator, expand Database > soademo > SOADEMO. Expand the Sequences and Tables nodes and verify that the tables match those listed in Section 1.4, "Contents of the SOADEMO Schema".
8. 9.
2-10
In Oracle JDeveloper, select View > Connection Navigator. Right-click the Application Server node and select New Application Server Connection. Click Next on the Welcome page. In Step 1, Type, enter the following values:
Connection Name: enter SoademoApplicationServer. Connection Type: select Oracle Application Server 10g 10.1.3.
Click Next.
5.
Username: enter oc4jadmin. This is the name of the administration user. Password: enter the password for oc4jadmin. This is the password that you set when you installed Oracle Application Server. Deploy Password: select the check box.
Click Next.
6.
Connect To: select Single Instance. Host Name: enter the name of the machine where you installed Oracle Application Server. OPMN Port: enter the OPMN port for the Oracle Application Server instance. You can determine this port by looking in the ORACLE_
2-11
HOME\opmn\conf\opmn.xml file. You want the port number specified in the request attribute. For example:
<notification-server> <port local="6100" remote="6202" request="6005"/>
Click Next.
7.
In Step 4, Test, click Test Connection. If the test is not successful, check that the Oracle Application Server instance is available and that the connection values are correct. You can click the Back button to return to the previous page to edit the connection values. Click Finish. The connection appears below the Application Server node in the Connection Navigator.
8.
In Oracle JDeveloper, select View > Connection Navigator. Right-click the Integration Server node and select New Integration Server Connection. Click Next on the Welcome page. In Step 1, Name, enter the following value:
Click Next.
5.
Application Server: enter SoademoApplicationServer, which is the Application Server connection that you just created (in Section 2.7.2, "Create a Connection to Oracle Application Server"). Hostname: The value is derived from the Application Server connection. Port Number: enter the port number that Oracle Application Server listens at for HTTP requests from clients. This is typically the Oracle HTTP Server port. If there is no Oracle HTTP Server component, then specify the OC4J port. The default port is 8888.
Click Next.
6.
In Step 3, Test Connection, click Test Connection. If the test is not successful, check that the Oracle Application Server instance is available and that the connection values are correct. You can click the Back button to return to the previous page to edit the connection values. Click Finish. The connection appears below the Integration Server node in the Connection Navigator.
7.
2-12
In Oracle JDeveloper, select View > Application Navigator. Right-click the Applications node and select New Application. In the Create Application dialog, enter these values:
Application Name: enter SOADEMO. Directory Name: Accept the default directory location or edit it to specify a different directory location. JDeveloper will create this directory, which will contain all the projects in the SOA Order Booking application. Application Package Prefix: enter oracle.soademo. Application Template: select No Template [All Technologies].
Click OK.
4.
In the Create Project dialog, click Cancel. You will create the projects later.
2-13
2-14
3
Creating the CustomerService Project
This chapter describes how to create the CustomerService project. It contains these sections:
Section 3.1, "About the CustomerService Project" Section 3.2, "Create a New Project for CustomerService" Section 3.3, "Create Entity Beans from Tables in the Database" Section 3.4, "Edit persistence.xml" Section 3.5, "Create a Session Bean in the business Directory" Section 3.6, "Define Additional Queries in Customer.java" Section 3.7, "Use a Database Sequence to Generate Address IDs in Address.java" Section 3.8, "Edit Session Facade for the Session Bean (CustomerServiceBean.java)" Section 3.9, "Add and Modify Methods in the Session Bean (CustomerServiceBean.java)" Section 3.10, "Add JSR-181 Annotations to the Web Service Endpoint Interface (CustomerService.java)" Section 3.11, "Create EJB JAR Deployment Profile for the CustomerService Project" Section 3.12, "Deploy CustomerService" Section 3.13, "View the WSDL for CustomerService"
The project is invoked directly by the SOADemo-Client application. When a customer logs in using the client application, the client application invokes the CustomerService project to validate the user. The project uses Java Persistence API entity objects to manage the CUSTOMER and ADDRESS tables in the SOADEMO schema in the database. The project uses an EJB 3.0 stateless session bean with JSR-181 Web Services annotations. This means that application servers that support JSR-181 are able to publish the bean as a web service during deployment. Methods in CustomerService that you want to make public (that is, invocable by client
Creating the CustomerService Project 3-1
applications) are defined in this bean. Client applications can then invoke the methods through Web Services.
The SOAOrderBooking project, which is a BPEL process, also invokes the CustomerService project to get details on the customer, such as the customers status (for example, platinum or gold).
Right-click the SOADEMO application, and select New Project. In the New Gallery, in the Categories section, expand General and select Projects. In the Items section, select Empty Project.
Click OK.
3.
In the Create Project dialog, enter CustomerService in the Project Name field.
Click OK. In the Application Navigator, you should see an empty CustomerService project located under the SOADEMO application.
3-2
4.
Right-click the CustomerService project, and select New. In the New Gallery, in the Categories section, expand Business Tier and select EJB. In the Items section, select Entities From Tables (JPA/EJB 3.0). Click OK.
Figure 33 New Gallery for Creating Entity Objects from Database Tables
On the Welcome page of the Create Entities From Tables wizard, click Next. In Step 1, Database Connection Details, select the database connection and click Next.
Figure 34 Create Entities From Tables Wizard: Step 1, Database Connection Details
4.
Name Filter is blank. Auto-Query is not selected. Schema is set to SOADEMO. Tables is selected.
Click Query. You should see a list of tables in the SOADEMO schema.
5.
Select Address and Customer and click the single blue arrow to move them to the Selected box.
3-4
Click Next.
6.
Package Name: set it to org.soademo.customerservice.persistence. Place member-level annotations on: Fields. Implement java.io.Serializable: select this option. Collection type for relationship fields: select java.util.List.
Figure 37 Create Entities From Tables Wizard: Step 3, Entities From Tables
Click Next.
7.
Figure 38 Create Entities From Tables Wizard: Step 4, Specify Entity Details, Showing Values for Address Table
Figure 39 Create Entities From Tables Wizard: Step 4, Specify Entity Details, Showing Values for Customer Table
Click Next.
8. 9.
In the Summary screen, click Finish. Select File > Save to save your work.
3-6
Edit persistence.xml
SOADEMO refers to the directory where you created the SOADEMO application. The Application Navigator looks something like this:
Figure 310 Application Navigator Showing the Created Files
Change the name of the persistence-unit from "CustomerService" to "customerServiceUnit". This name is used in the CustomerServiceBean.java session bean that you will create in Section 3.5, "Create a Session Bean in the business Directory".
Add a line to define the jta-data-source: <jta-data-source>jdbc/soademoDS</jta-data-source> jdbc/soademoDS is the data source that you created in Oracle Application Server in Section 2.6.3, "Create a Data Source".
Check that you do not have any unsaved changes in the CustomerService project. In the Application Navigator, if you see any items that appear in italics, select the item and select File > Save. Select View > Structure to display the Structure window. Select persistence.xml in the Application Navigator. You should see the structure of the file in the Structure window.
2. 3.
Edit persistence.xml
Figure 311 Structure Window (below the Application Navigator) Showing the Structure of persistence.xml
4. 5.
Double-click persistence-unit in the Structure window. This displays the persistence-unit Properties dialog. In the persistence-unit Properties dialog:
Figure 312
6. 7.
Click OK. The persistence.xml file in the Application Navigator should appear in italics, which indicates that it has unsaved changes. Double-click the persistence.xml file in the Application Navigator. This displays the contents of the file in the editor. The file should look like this:
Example 31
persistence.xml
<?xml version="1.0" encoding="windows-1252" ?> <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" xmlns="http://java.sun.com/xml/ns/persistence"> <persistence-unit name="customerServiceUnit">
3-8
Select File > Save to save the file. Close the file in the editor.
Right-click the CustomerService project, and select New. In the New Gallery, in the Categories section, expand Business Tier and select EJB. In the Items section, select "Session Bean (EJB 1.1/2.x/3.0)". Click OK.
New Gallery for Creating Session Bean
Figure 313
On the Welcome page of the Create Session Bean wizard, click Next. In Step 1, EJB Name and Options:
EJB Name: enter CustomerService. Session Type: select Stateless. Transaction Type: select Container. Generate Session Facade Methods: select this option. Entity Implementation: select EJB 3.0 Entities. Persistence Unit: select customerServiceUnit (CustomerService.jpr).
Figure 314
Click Next.
4.
In Step 2, Session Facade - Select EJB 3.0 Entity Methods, deselect everything. You will generate methods for the Customer entity later.
Create Session Bean Wizard: Step 2, Session Facade - Select EJB 3.0 Entity
Click Next.
5.
Bean Class: enter org.soademo.customerservice.business.CustomerServiceBean. Source directory: accept the default (CustomerService\src directory).
3-10
Figure 316
Click Next.
6.
value.
Implement a Local Interface: select this option. Local Interface: org.soademo.customerservice.business.CustomerServiceLocal. Include Web Service Endpoint Interface: select this option. Web Service Endpoint Interface: org.soademo.customerservice.business.CustomerService.
Note: The name of the web service endpoint interface is different
from the default value. Note that selecting the Include Web Service Endpoint Interface option adds the JSR-181 library to the project. This library is needed for the project to compile. You can also add this library to the project later, if it is not already added. In the generated WSDL, the name of the web service endpoint interface ("CustomerService") is used as a prefix for message names. It is also used as the name for the port type. You need to consider this because this affects the SOAOrderBooking project. The CustomerSvc.wsdl file in the SOAOrderBooking\bpel directory specifies "CustomerService" as the name of the port type. The port type names in the CustomerSvc.wsdl file and in the generated CustomerService WSDL must match. After you deploy the
3-11
CustomerService project, you can view the generated WSDL as described in Section 3.13, "View the WSDL for CustomerService".
Figure 317 Create Session Bean Wizard: Step 4, EJB Component Interfaces
Click Next.
7. 8. 9.
In the Summary page, click Finish. Select CustomerService in the Application Navigator and select File > Save to save your work. JDeveloper displays the CustomerServiceBean.java file in the editor. You can close it.
In the Application Navigator, you should see the CustomerService session bean in the business directory.
Figure 318 Application Navigator Showing the CustomerService Session Bean in the business Directory
3-12
package org.soademo.customerservice.persistence; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import import import import import import import import import import import import import import import javax.persistence.CascadeType; javax.persistence.Column; javax.persistence.Entity; javax.persistence.FetchType; javax.persistence.GeneratedValue; javax.persistence.GenerationType; javax.persistence.Id; javax.persistence.JoinColumn; javax.persistence.JoinTable; javax.persistence.NamedQueries; javax.persistence.NamedQuery; javax.persistence.OneToMany; javax.persistence.SequenceGenerator; javax.persistence.Table; javax.persistence.TableGenerator;
// Note that the query statements between the double quotes must be on one line. @Entity @NamedQueries( { @NamedQuery(name = "Customer.findAllCustomer", query = "select object(o) from Customer o") , @NamedQuery(name = "Customer.findCustomerById", query = "select object(cust) from Customer cust where cust.custid = :custid") , @NamedQuery(name = "Customer.findCustomerByEmail", query = "select object(cust) from Customer cust where cust.email = :email and cust.password = :password") } ) @Table(name = "CUSTOMER") @SequenceGenerator(name = "SEQ_ID_GENERATOR", sequenceName = "EJB_SEQ_ID_GEN") @TableGenerator(name = "TABLE_ID_GENERATOR", table = "EJB_TAB_ID_GEN", pkColumnName = "ID_NAME", valueColumnName = "SEQ_VALUE", pkColumnValue = "SEQ_GEN") public class Customer implements Serializable { private String creditcardnumber; Creating the CustomerService Project 3-13
private String creditcardtype; @Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "TABLE_ID_GENERATOR") @Column(nullable = false) private String custid; private String email; private String fname; private String lname; private String phonenumber; private String status; private String password; @OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL } ) @JoinTable(name = "CUSTOMER_ADDRESS", joinColumns = { @JoinColumn(name = "CUSTID") } , inverseJoinColumns = { @JoinColumn(name = "ADDRESSID") } ) private List<Address> addressList; public Customer() { } public String getCreditcardnumber() { return creditcardnumber; } public void setCreditcardnumber(String creditcardnumber) { this.creditcardnumber = creditcardnumber; } public String getCreditcardtype() { return creditcardtype; } public void setCreditcardtype(String creditcardtype) { this.creditcardtype = creditcardtype; } public String getCustid() { return custid; } public void setCustid(String custid) { this.custid = custid; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getFname() { return fname; } public void setFname(String fname) {
3-14
this.fname = fname; } public String getLname() { return lname; } public void setLname(String lname) { this.lname = lname; } public String getPhonenumber() { return phonenumber; } public void setPhonenumber(String phonenumber) { this.phonenumber = phonenumber; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public List<Address> getAddressList() { if (addressList == null) { addressList = new ArrayList(); } return addressList; } public void setAddressList(List<Address> addressList) { this.addressList = addressList; } public Address addAddress(Address address) { getAddressList().add(address); return address; } public Address removeAddress(Address address) { getAddressList().remove(address); return address; } public void setPassword(String password) { this.password = password; } public String getPassword() { return password; } }
3-15
@Entity @NamedQuery(name = "Address.findAllAddress", query = "select object(o) from Address o") @Table(name = "ADDRESS") public class Address implements Serializable { private String addresstype; @Id @SequenceGenerator(name = "ADDRESS_ID_GEN", sequenceName = "ADDRESS_EJB_SEQ_ID_GEN") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ADDRESS_ID_GEN") @Column(nullable = false) private String addrid; private String city; private String country; private String state; private String street; private String zip; ...
Right-click CustomerServiceBean.java and select Edit Session Facade. This displays the Specify Session Facade Options dialog. In the dialog, expand Customer and select:
findCustomerById
3-16
findCustomerByEmail
You do not need to select the other methods because they are not used by the SOA Order Booking application.
Figure 319 Specify Session Facade Options Dialog
3. 4.
Click OK. JDeveloper modifies CustomerServiceBean.java to include the selected methods. JDeveloper displays CustomerServiceBean.java in the editor. Select File > Save to save it, but do not close it yet, for you will be editing it.
Section 3.9.1, "Modify queryCustomerFindCustomerById" Section 3.9.2, "Modify queryCustomerFindCustomerByEmail" Section 3.9.3, "Add getCustomerStatus and addNewCustomer Methods"
Change it so that it returns a single value instead of a list. Modify its name to findCustomerById.
Although you can edit the file directly, it is better to make the changes using the property dialog in JDeveloper because it will synchronize the changes in other files, such as the interface files (CustomerServiceRemote.java, CustomerServiceLocal.java, and CustomerService.java) that this class implements.
3-17
1. 2. 3. 4. 5.
If CustomerServiceBean.java is not showing in the editor, double-click it in the Application Navigator. Select View > Structure to display the Structure window. Select CustomerServiceBean.java in the Application Navigator. In the Structure window, right-click the queryCustomerFindCustomerById method and select Properties. This displays the Bean Method Details dialog. In the Bean Method Details dialog:
Name: change to findCustomerById. Return Type: remove java.util.List and the angle brackets so that it returns only Customer, specified in its full package name (org.soademo.customerservice.persistence.Customer). Parameters: change Object to String.
6. 7.
Click OK. You can see the changes in the editor. Make these additional changes to the findCustomerById method in the editor:
Cast the return value to Customer. Change the last method to getSingleResult (instead of getResultList).
Select File > Save to save your changes. In the Structure window, expand Sources. You should see the interface files listed under Sources.
3-18
CustomerServiceLocal.java, and CustomerService.java) to display them in the editor. The interface files are listed under Sources in the Structure window. After you double-click an interface file, you need to re-select CustomerServiceBean.java in the Application Navigator. The interface files are listed as the sources for CustomerServiceBean.java. Notice that JDeveloper has updated the methods in these interface files to synchronize with your updates.
Figure 321 Application Navigator and Structure Window Showing the Structure for CustomerServiceBean.java
Change it so that it returns a single value instead of a list. Modify its name to findCustomerByEmail.
Although you can edit the file directly, it is better to make the changes using the property dialog in JDeveloper because it will synchronize the changes in other files, such as the interface files (CustomerServiceRemote.java, CustomerServiceLocal.java, and CustomerService.java) that this class implements.
1. 2.
Select CustomerServiceBean.java in the Application Navigator. In the Structure window, right-click the queryCustomerFindCustomerByEmail method and select Properties. This displays the Bean Method Details dialog.
3-19
3.
Name: change to findCustomerByEmail. Return Type: remove java.util.List and the angle brackets so that it returns only Customer, specified in its full package name (org.soademo.customerservice.persistence.Customer). Parameters: for both parameters, change Object to String.
4. 5.
Click OK. You can see the changes in the editor. Make these additional changes to the findCustomerByEmail method in the editor:
Cast the return value to Customer. Change the last method to getSingleResult (instead of getResultList).
public Customer findCustomerByEmail(String email, String password) { return (Customer)em.createNamedQuery("Customer.findCustomerByEmail"). setParameter("email", email).setParameter("password",password). getSingleResult(); } 6. 7.
Select File > Save to save your changes. In the Structure window, expand Source and double-click the interface files (CustomerServiceRemote.java, CustomerServiceLocal.java, and CustomerService.java) to display them in the editor. Notice that JDeveloper has updated the methods in these files to synchronize with your updates. Save the interface files.
8.
3-20
Display CustomerServiceBean.java in the editor. Select View > Structure to display the Structure window, if it is not already showing. In the Structure window, right-click Methods and select New Method. This displays the Bean Method Details dialog. In the Bean Method Details dialog:
Name: enter getCustomerStatus. Return Type: select java.lang.String. Parameters: enter String CustomerID.
5. 6.
Click OK. In the editor for CustomerServiceBean.java, enter the body of the method. See Example 35:
getCustomerStatus
Example 35
Save the file. Notice that JDeveloper updates the interface files with this new method.
8.
Repeat the same procedure to create the addNewCustomer method. In the Bean Method Details dialog, enter these values:
3-21
Name: enter addNewCustomer. Return Type: select java.lang.String. Parameters: enter Customer customer.
9.
10. In the editor for CustomerServiceBean.java, add the body for the method. Example 36 addNewCustomer
public String addNewCustomer(Customer customer) { em.persist(customer); return "New customer added sucessfully to customer database"; } 11. Save the CustomerServiceBean.java file. 12. Save the interface files.
3.10 Add JSR-181 Annotations to the Web Service Endpoint Interface (CustomerService.java)
The CustomerService.java file was generated as the web service endpoint interface for the CustomerService session bean. You add JSR-181 annotations to this file to refine the names of methods and parameters. Edit the file so that it looks like the following. You can edit the file in the editor.
Example 37 CustomerService.java
3-22
import javax.jws.WebParam; import javax.jws.WebService; import org.soademo.customerservice.persistence.Customer; @WebService(serviceName = "CustomerSvc", targetNamespace = "http://www.globalcompany.com/ns/customer") public interface CustomerService { @WebMethod Customer findCustomerById( @WebParam(name = "custid", targetNamespace = "http://www.globalcompany.com/ns/customer") String custid) throws RemoteException; @WebMethod String getCustomerStatus( @WebParam(name = "CustomerID", targetNamespace = "http://www.globalcompany.com/ns/customer") String CustomerID); @WebMethod String addNewCustomer( @WebParam(name = "customer", targetNamespace = "http://www.globalcompany.com/ns/customer") Customer customer); @WebMethod Customer findCustomerByEmail( @WebParam(name = "email", targetNamespace = "http://www.globalcompany.com/ns/customer") String email, @WebParam(name = "password", targetNamespace = "http://www.globalcompany.com/ns/customer") String password); }
3.11 Create EJB JAR Deployment Profile for the CustomerService Project
Create a deployment profile so that you can easily deploy the CustomerService project to Oracle Application Server from JDeveloper. To create a deployment profile:
1.
Right-click the CustomerService project and select New. In Categories, expand General and select Deployment Profiles. In Items, select EJB JAR File.
3-23
Figure 325
New Gallery for Creating a Deployment Profile for EJB JAR File
Click OK.
2.
Deployment Profile Name: enter CustomerService. Directory: use the default (CustomerService directory).
Create Deployment Profile - EJB JAR File Dialog
Figure 326
Click OK.
3.
In the EJB JAR Deployment Profile Properties dialog, accept the defaults.
3-24
Deploy CustomerService
Figure 327
4.
Click OK.
To deploy the CustomerService project, right-click CustomerService.deploy in the Application Navigator and select Deploy To > SoademoApplicationServer, where SoademoApplicationServer specifies the connection to Oracle Application Server. JDeveloper compiles the application and creates JAR and EAR files in the CustomerService\deploy directory. If there are no errors, it displays the Configure Application dialog.
3-25
Figure 329
2.
Click OK.
Watch the messages in the JDeveloper log area for any errors.
3-26
3-27
3-28
4
Creating the FulfillmentESB Project
This chapter describes how to create the FulfillmentESB project. It contains these sections:
Section 4.1, "About the FulfillmentESB Project" Section 4.2, "Create a New Project for FulfillmentESB" Section 4.3, "Create a System Called "Fulfillment"" Section 4.4, "Create the "OrderFulfillment" Routing Service" Section 4.5, "Create the "Shipment" Routing Service" Section 4.6, "Create the "USPSShipment" Adapter (File Adapter)" Section 4.7, "Create the "FedexShipment" Adapter (Database Adapter)" Section 4.8, "Create the "FulfillmentBatch" Adapter (JMS Adapter)" Section 4.9, "Create Routing Rules" Section 4.10, "Save All Files in the FulfillmentESB Project" Section 4.11, "Register the FulfillmentESB Project"
OrderFulfillment routing service Shipment routing service USPSShipment file adapter FedexShipment database adapter FulfillmentBatch JMS adapter
Right-click the SOADEMO application, and select New Project. In the New Gallery, in the Categories section, expand General and select Projects. In the Items section, select ESB Project.
4-2
Figure 42 New Gallery: Select "ESB Project" for the FulfillmentESB Project
Click OK.
3.
In the Create ESB Project dialog, enter FulfillmentESB in the Project Name field. Accept the defaults for the other fields.
Click OK. JDeveloper displays a blank page for the FulfillmentESB.esb file. In the Application Navigator, this file is located under FulfillmentESB > Resources:
In the empty FulfillmentESB.esb page, click the Create System/Group icon, located at the top of the page.
2.
System: select this option. Name: enter Fulfillment. Description: leave blank or enter a brief description.
4-4
Figure 46 Create ESB System or Service Group Dialog for the "Fulfillment" System
3.
Click OK. In the Application Navigator, you should see a Fulfillment.esbsys file under FulfillmentESB > Resources.
Shipment, which is another routing service FulfillmentBatch, which sends messages to a Java Messaging Service (JMS)
Copy the following file from the soademo_101310_prod.zip file to the SOADEMO\FulfillmentESB directory:
OrderBookingPO.xsd
In the zip file, this file is located in the FulfillmentESB directory. This file is needed by the OrderFulfillment routing service.
2. 3. 4. 5.
If the Component Palette is not showing in JDeveloper, select View > Component Palette to display it. Select ESB Services from the dropdown in the Component Palette. Drag the Routing Service icon from the Component Palette and drop it anywhere on the FulfillmentESB page. In the Create Routing Service dialog:
Name: enter OrderFulfillment. System/Group: set to Fulfillment. If it is not set to Fulfillment, click the flashlight, which displays the ESB Service Group Browser dialog. Select Fulfillment in the dialog and click OK.
Generate WSDL From Schemas: select this option. Schema Location: click Browse, which displays the Type Chooser dialog. In the dialog, select Project Schema Files > OrderBookingPO.xsd > PurchaseOrder.
Schema Element: select PurchaseOrder. Operation Name: enter execute. Namespace: enter http://www.globalcompany.com/ns/Fulfillment.
The Create Routing Service dialog should now look like this.
4-6
Figure 49 Create Routing Service Dialog for the OrderFulfillment Routing Service
6.
Fulfillment_OrderFulfillment.esbsvc - this file defines the "OrderFulfillment" routing service. JDeveloper prefixes the system name to the filename. Fulfillment_OrderFulfillment.wsdl - this WSDL file is for the "OrderFulfillment" routing service.
Drag the Routing Service icon from the Component Palette and drop it anywhere on the FulfillmentESB page. In the Create Routing Service dialog:
Name: enter Shipment. System/Group: should be set to Fulfillment. If not, click the flashlight icon to change it. Generate WSDL From Schemas: select this option. Schema Location: click Browse, which displays the Type Chooser dialog. In the dialog, select Project Schema Files > OrderBookingPO.xsd > PurchaseOrder.
Type Chooser Dialog for Shipment Routing Service
Figure 411
Schema Element: select PurchaseOrder. Operation Name: enter execute. Namespace: enter http://www.globalcompany.com/ns/shipment.
The Create Routing Service dialog should now look like this:
4-8
Figure 412
3.
Fulfillment_Shipment.esbsvc - this file defines the "Shipment" routing service. JDeveloper prefixes the system name to the filename. Fulfillment_Shipment.wsdl - this WSDL file is for the "Shipment" routing service.
Copy the following file from the soademo_101310_prod.zip file to the FulfillmentESB directory:
USPSShipment.xsd
In the Component Palette, select Adapter Services from the dropdown. Drag the File Adapter icon from the Component Palette and drop it anywhere on the FulfillmentESB page. In the Create File Adapter Service dialog:
Name: enter USPSShipment. System/Group: should be set to Fulfillment. If not, click the flashlight icon to change it. WSDL File: click the Configure Adapter Service WSDL icon (the one on the left), which launches the Adapter Configuration wizard. Click Next on the Welcome page of the wizard. Step 1, Service Name:
Figure 414
4-10
Step 2, Operation:
Figure 415 Adapter Configuration Wizard, Step 2, Operation
Operation Type: select Write File. Operation Name: should be filled in with Write. Click Next.
Directory for Outgoing Files: enter the directory where you want the adapter to write the files. For example, you can enter C:\temp.
running Oracle Application Server, not the machine where you are running JDeveloper. File Naming Convention: specify how you want to name the files. Enter shipment_%SEQ%.txt. The %SEQ% indicates that the filenames will be numbered sequentially. Number of Messages Equals: You can leave it at 1, which means that each order will be written in a separate file. Click Next.
Step 4, Messages:
Figure 417 Adapter Configuration Wizard, Step 4, Messages
Native format translation is not required (Schema is Opaque): do not select this option. Schema Location. Click Browse. In the Type Chooser, select Project Schema Files > USPSShipment.xsd > shipment.
4-12
Figure 418
Click OK in the Type Chooser. Schema Element: should be set to shipment. Click Next.
On the Finish page, click Finish. The wizard creates the following files in the FulfillmentESB directory: USPSShipment.wsdl - this file contains the information you specified in the wizard. fileAdapterOutboundHeader.wsdl - this file contains generic information for writing to files.
The Create File Adapter Service dialog should now look like this. JDeveloper automatically filled in Write_ptt for Port Type.
Create File Adapter Service Dialog for the USPSShipment File Adapter
5.
In JDeveloper, you should see two routing services and a file adapter service:
Figure 420 JDeveloper Showing the OrderFulfillment and Shipment Routing Services, and the USPSShipment File Adapter Service
4-14
1.
Copy the following file from the soademo_101310_prod.zip file to the FulfillmentESB directory:
FedexShipment_table.xsd
In the Component Palette, select Adapter Services from the dropdown. Drag the Database Adapter icon from the Component Palette and drop it anywhere on the FulfillmentESB page. In the Create Database Adapter Service dialog:
Name: enter FedexShipment. System/Group: should be set to Fulfillment. If not, click the flashlight icon to change it. WSDL File: click the Configure Adapter Service WSDL icon (the one on the left), which launches the Adapter Configuration wizard. Click Next on the Welcome page of the wizard. Step 1, Service Name:
Figure 421
Figure 422
Connection: select the database connection for the SOADEMO schema. JNDI Name: enter eis/DB/soademo. This is the JNDI location you specified when you created connection factory in Oracle Application Server (see Section 2.6.4, "Create a Database Adapter Connection Factory"). Click Next.
Select Perform an Operation on a Table, and select Insert Only. The SOA Order Booking application only needs to insert rows in the table. Click Next.
4-16
Step 4, Select Table, click Import Tables. In the Import Tables dialog, click Query. Select FEDEXSHIPMENT and click the right-arrow button to move it the Selected box. The FEDEXSHIPMENT table is the table that the database adapter will write to.
Figure 424 Import Tables Dialog for FedexShipment
Click OK in the Import Tables dialog. Step 4, Select Table, now looks like this:
Figure 425 Adapter Configuration Wizard, Step 4, Select Table
Select the SOADEMO.FEDEXSHIPMENT table and click Next. In Step 5, Relationships, click Next.
Figure 426
On the Finish page, click Finish. The wizard creates the following files in the FulfillmentESB directory: DBAdapterOutboundHeader.wsdl -- this file contains the generic information for connecting to a database. FedexShipment.wsdl -- this file contains the information that you specified in the wizard. FedexShipment_toplink_mappings.xml -- this file is used by TopLink src\* database\* toplink\*
The Create Database Adapter Service dialog now looks like this:
4-18
Figure 427 Create Database Adapter Service Dialog for the FedexShipment Database Adapter Service
5.
In JDeveloper, you should see two routing services, a file adapter service, and a database adapter service.
Figure 428 JDeveloper Showing the OrderFulfillment and Shipment Routing Services, the USPSShipment File Adapter Service, and the FedexShipment Database Adapter Service
1. 2. 3.
In the Component Palette, select Adapter Services from the dropdown. Drag the JMS Adapter icon from the Component Palette and drop it anywhere on the FulfillmentESB page. In the Create JMS Adapter Service dialog:
Name: enter FulfillmentBatch. System/Group: should be set to Fulfillment. If not, click the flashlight icon to change it. WSDL File: click the Configure Adapter Service WSDL icon (the one on the left), which launches the Adapter Configuration wizard. Click Next on the Welcome page of the wizard. Step 1, Service Name:
Figure 429
4-20
Figure 430
Select Oracle Enterprise Messaging Service (OEMS) and select Memory/File from the dropdown. Click Next.
In the Connection dropdown, select the connection to Oracle Application Server. Click Next.
Step 4, Operation:
Figure 432
Operation Type: select Produce Message. Operation Name: enter sendMessage. Click Next.
Step 5, Produce Operation Parameters, click Browse. This displays the Select Destination dialog. In the dialog, select demoQueue (queue), and click OK.
Figure 433 Select Destination Dialog
4-22
The rest of the values in Step 5 are filled in for you. You can just accept these values.
Figure 434 Adapter Configuration Wizard, Step 5, Produce Operation Parameters
Click Next. Step 6, Messages: Native format translation is not required (Schema is Opaque): do not select this option. Schema Location: click Browse, which displays the Type Chooser. Select Project Schema Files > OrderBookingPO.xsd > PurchaseOrder.
Type Chooser for the FulfillmentBatch JMS Adapter Service
Figure 435
Figure 436
Click Next. On the Finish page, click Finish. The wizard created the following files in the FulfillmentESB directory: jmsAdapterOutboundHeader.wsdl FulfillmentBatch.wsdl
The Create JMS Adapter Service dialog now looks like this:
Figure 437 Service Create JMS Adapter Service Dialog for the FulfillmentBatch JMS Adapter
4.
In JDeveloper, you should see two routing services, a file adapter service, a database adapter service, and a JMS adapter service.
4-24 Oracle SOA Suite Tutorial
Figure 438
Section 4.9.1, "Between OrderFulfillment and Shipment" Section 4.9.2, "Between OrderFulfillment and JMS Adapter" Section 4.9.3, "Between Shipment and USPSShipment" Section 4.9.4, "Between Shipment and FedexShipment"
Double-click OrderFulfillment in the top section of the icon. This displays the page for the Fulfillment_OrderFulfillment.esbsvc file.
Figure 439
2. 3.
In the Routing Rules section, click the [+] to expand it. Click the green + icon to add a routing route. This displays the Browse Target Service Operation dialog. You may have to scroll to the right to see the green + icon.
4.
In the Browse Target Service Operation dialog, select Services In Project > Fulfillment > Shipment > execute.
Browse Target Service Operation Dialog
Figure 440
5.
Click OK in the Browse Target Service Operation dialog. The routing rule area now looks like this:
4-26
Figure 441
6.
For this routing rule, there are no filters and no transformations. The OrderFulfillment routing service routes all orders to the Shipment routing service. The data is not transformed in any way. Click the FulfillmentESB.esb tab in JDeveloper. You should see an arrow going from OrderFulfillment to Shipment.
Figure 442 JDeveloper Showing Routing from OrderFulfillment to Shipment
Double-click OrderFulfillment in the top section of the icon. This displays the page for the Fulfillment_OrderFulfillment.esbsvc file. In the Routing Rules section, click the [+] to expand it. You should see the rule that you created in the previous section (Section 4.9.1, "Between OrderFulfillment and Shipment").
Figure 443
3. 4.
Click the green + icon to add another routing route. You may have to scroll to the right to see the + icon. In the Browse Target Service Operation dialog, select Services In Project > Fulfillment > FulfillmentBatch > sendMessage.
Browse Target Service Operation Dialog
Figure 444
5.
Click OK in the Browse Target Service Operation dialog. The routing rule area now contains two rules:
4-28
Figure 445
6.
Click the FulfillmentESB.esb tab in JDeveloper. From OrderFulfillment, there should be two arrows: one going to Shipment and one going to FulfillmentBatch.
Figure 446 JDeveloper Showing Routing from OrderFulfillment to Shipment and JMSAdapter
Double-click Shipment in the top section of the icon. This displays the page for the Fulfillment_Shipment.esbsvc file. In the Routing Rules section, click the [+] to expand it.
3. 4.
Click the green + icon to add a routing route. You may have to scroll to the right to see the + icon. In the Browse Target Service Operation dialog, select Services In Project > Fulfillment > USPSShipment > Write.
Browse Target Service Operation Dialog
Figure 447
5.
Click OK in the Browse Target Service Operation dialog. The routing rule area now looks like this:
Figure 448
6.
Select File > Save to save your work. Click the FulfillmentESB.esb tab in JDeveloper. You should see an arrow going from Shipment to USPSShipment.
4-30
Figure 449
7.
Create the filter so that only orders under $500 are directed to USPSShipment.
a. b. c.
Double-click Shipment in the top section of the icon to display the page for the Fulfillment_Shipment.esbsvc file. In the page for the Fulfillment_Shipment.esbsvc file, click the filter icon in the routing rules area. This displays the Expression Builder dialog. In the Expression Builder dialog, in the WSDL Message box, select Purchase Order_request > PurchaseOrder > inp1:PurchaseOrder > inp1:OrderInfo > inp1:OrderPrice. The Content Preview box shows the path: /inp1:PurchaseOrder/inp1:OrderInfo/inp1:OrderPrice.
d. e.
Click Insert Into Expression. The path appears in the Expression box at the top of the dialog. In the Expression box, append < 500 to the path, so that it now reads /inp1:PurchaseOrder/inp1:OrderInfo/inp1:OrderPrice < 500.
Figure 450
f. g. 8.
Click OK in the Expression Builder. Select File > Save to save your work.
Create a transformation so that the USPSShipment file adapter gets the proper information in the proper fields.
a. b.
Click the transformation icon in the Routing Rules area. In the Request Transformation Map dialog, select Create New Mapper File and enter PurchaseOrder_To_USPSshipment.xsl as the filename.
Request Transformation Map Dialog
Figure 451
c.
4-32
Figure 452
Data Mapper
d. e. f.
On the source (left) side, expand inp1:ShipTo > inp1:Name and inp1:ShipTo > inp1:Address. Click and drag inp1:First to imp1:fname. Click and drag inp1:Last to imp1:lname. There should be two lines, one for First/fname and another one for Last/lname.
Figure 453
g.
Click and drag to connect these pairs: inp1:Street to imp1:address inp1:City to imp1:city inp1:State to imp1:state inp1:Zip to imp1:zipcode inp1:Country to imp1:country
h. i.
Select Conversion Functions from the dropdown in the Component Palette. You will need the string function for the next step. For each of the pairs listed in step (g), drag the string function from the Component Palette and drop it on each of the lines. You should end up with a diagram that looks like this:
Figure 454
9.
Select File > Save to save your work. area, in the transformation section, you should see the name of the transformation file.
Figure 455 Fulfillment_Shipment.esbsvc Showing Filter Information and Name of Transformation File
11. Select File > Save to save Fulfillment_Shipment.esbsvc. 12. If you click the FulfillmentESB.esb tab, you can see that the filter and
transformation icons for the Shipment routing service are no longer greyed out, unlike those for the OrderFulfillment routing service.
4-34
Double-click Shipment or click the tab for Fulfillment_Shipment.esbsvc, if you have it open. This displays the page for the Fulfillment_Shipment.esbsvc file. In the Routing Rules section, click the [+] to expand it. Click the green + icon to add another routing route. You may have to scroll to the right to see the + icon. In the Browse Target Service Operation dialog, select Services In Project > Fulfillment > FedexShipment > insert.
Browser Target Service Operation Dialog
2. 3. 4.
Figure 456
5.
Click OK in the Browse Target Service Operation dialog. The routing rule area now looks like this:
Figure 457
6.
Select File > Save to save Fulfillment_Shipment.esbsvc. Click the FulfillmentESB.esb tab in JDeveloper. From Shipment, you should see two arrows: one going to USPSShipment and another one going to FedexShipment.
Figure 458 JDeveloper Showing Routing from Shipment to USPSShipment and FedexShipment
7.
Create the filter that directs orders that are equal to or greater than $500 to FedexShipment.
a. b.
Double-click Shipment to display the page for the Fulfillment_ Shipment.esbsvc file. In the page for the Fulfillment_Shipment.esbsvc file, click the filter icon for the FedexShipment rule in the routing rules area. This displays the Expression Builder dialog. In the Expression Builder dialog, in the WSDL Message box, select Purchase Order_request > PurchaseOrder > inp1:PurchaseOrder > inp1:OrderInfo > inp1:OrderPrice. The Content Preview box shows the path: /inp1:PurchaseOrder/inp1:OrderInfo/inp1:OrderPrice.
c.
d. e.
Click Insert Into Expression. The path appears in the Expression box at the top of the dialog. In the Expression box, append >= 500 to the path, so that it now reads /inp1:PurchaseOrder/inp1:OrderInfo/inp1:OrderPrice >= 500.
4-36
Figure 459
f. g. 8.
Click OK in the Expression Builder. Select File > Save to save your work.
Create a transformation so that the FedexShipment database adapter gets the proper information in the proper fields.
a. b.
Click the transformation icon in the Routing Rules area. In the Request Transformation Map dialog, select Create New Mapper File and enter PurchaseOrder_To_FedexshipmentCollection.xsl as the filename.
Request Transformation Map Dialog
Figure 460
c. d. e. f.
Click OK. This brings up the Data Mapper. On the source (left) side, expand inp1:ShipTo > inp1:Name and inp1:ShipTo > inp1:Address. On the target (right) side, expand top:FedexshipmentCollection > top:Fedexshipment. Click and drag to connect these pairs: inp1:ID to top:orderid inp1:First to top:fname
Figure 461
inp1:Last to top:lname inp1:Street to top:street inp1:City to top:city inp1:State to top:state inp1:Zip to top:zipcode
Data Mapper Showing Transformation from Shipment to FedexShipment
9.
Select File > Save to save PurchaseOrder_To_ FedexshipmentCollection.xsl. area, in the transformation section, you should see the name of the transformation file.
4-38
Figure 462 Fulfillment_Shipment.esbsvc Showing Filter Information and Name of Transformation File
11. Select File > Save to save Fulfillment_Shipment.esbsvc. 12. If you click the FulfillmentESB.esb tab, you can see that there are two rows of icons
in the Shipment routing service icon and these icons are not greyed out.
Figure 463
4-40
5
Creating the CreditService Project
This chapter describes how to create the CreditService project. It contains these sections:
Section 5.1, "About the CreditService Project" Section 5.2, "Create a New Project for CreditService" Section 5.3, "Copy the WSDL File" Section 5.4, "Generate Java from the WSDL" Section 5.5, "Display the List of Files in the Structure Window" Section 5.6, "Build CreditService" Section 5.7, "Write the Code to Perform Credit Card Validation" Section 5.8, "Verify Hostname and Port in CreditService.wsdl" Section 5.9, "Update the Context-Root" Section 5.10, "Rebuild CreditService" Section 5.11, "Deploy Credit Service to Oracle Application Server"
If you are running JDeveloper and Oracle Application Server on different machines, change the localhost value to the name of the machine running Oracle Application Server. If your Oracle Application Server instance listens on a port other than 8888, you need to modify the port number.
Right-click the SOADEMO application, and select New Project. In the New Gallery, in the Categories section, expand General and select Projects. In the Items section, select Empty Project.
Click OK.
3.
In the Create Project dialog, enter "CreditService" in the Project Name field.
Click OK. In the Application Navigator, you should see an empty CreditService project located under the SOADEMO application.
4.
5-2
1. 2.
Right-click the CreditService project, and select New. In the New Gallery dialog, in the Categories section, expand Business Tier and select Web Services. In the Items section, select WSDL Document.
WSDL Name: enter CreditService. Directory Name: accept the default (SOADEMO\CreditService\src). Target Namespace: accept the default because you are going to overwrite the generated WSDL file anyway. In the WSDL file, the target namespace is http://www.globalcompany.com/ns/credit.
4. 5.
Click OK. Close (by selecting File > Close) the CreditService.wsdl file that JDeveloper displays in the editor.
6.
Copy CreditService\src\CreditService.wsdl from the soademo_ 101310_prod.zip file and overwrite the generated CreditService.wsdl in the SOADEMO\CreditService\src directory.
Right-click the CreditService project, and select New. In the New Gallery, in the Categories section, expand Business Tier and select Web Services. In the Items section, select Java Web Service from WSDL.
Click OK. This launches the Create J2EE 1.4 Java Web Service from WSDL wizard. Click Next in the wizard to begin.
2.
In Step 1, Web Service Description, click Browse and select the CreditService.wsdl file from the SOADEMO\CreditService\src directory. Mapping File: leave blank.
5-4
Figure 56 Create J2EE 1.4 Java Web Service from WSDL Wizard: Step 1, Web Service Description
Click Next.
3.
Package Name: enter org.soademo.creditservice. Root Package for Generated Types: enter org.soademo.creditservice.types. Generate Data Binding Classes: select this option. Reuse Existing Type Classes: select this option. Map Headers to Parameters: select this option.
Figure 57 Create J2EE 1.4 Java Web Service from WSDL Wizard: Step 2, Default Mapping Options
Click Next.
4.
In Step 3, Specify Custom Data Type Serializer, leave blank and click Next.
Figure 58 Create J2EE 1.4 Java Web Service from WSDL Wizard: Step 3, Specify Custom Data Type Serializer
5.
Figure 59 Create J2EE 1.4 Java Web Service from WSDL Wizard: Step 4, Handler Details
6.
5-6
Figure 510
Create J2EE 1.4 Java Web Service from WSDL Wizard: Step 5, State
7.
In the Finish screen, click Finish. JDeveloper displays CreditService.wsdl in design view in the editor.
Select View > Structure to display the Structure window. In the Application Navigator, select SOADEMO > CreditService > Application Sources > org.soademo.creditservice > CreditService. In the Structure window, you should see the following files:
validOrNot = true; Long ccnum = new Long (creditCard.getCcNum()); if (ccnum < 12345678){ validOrNot = false; } else { validOrNot = true; } } else { validOrNot = false; } return validOrNot; }
You have to verify the hostname and port in both wsdl files.
1.
Double-click the first CreditService.wsdl (in the Application Navigator, CreditService.wsdl is located in SOADEMO > CreditService > Application Sources). In the editor, under Services, expand CreditService > ValidateCreditCardServiceSoapHttp > soap:address.
JDeveloper Showing the CreditService.wsdl File in the Editor
2.
Figure 511
3.
Right-click soap:address and select Properties. This displays the soap:address Properties dialog.
soap:address Properties Dialog
Figure 512
4.
In the location field, edit the hostname and port in the URL as necessary. You may need to scroll all the way to the left to see the beginning of the URL.
5-8
Rebuild CreditService
The hostname specifies where Oracle Application Server is running, and the port specifies the HTTP port at which Oracle HTTP Server or OC4J is listening.
5. 6. 7. 8.
Click OK if you made any changes to the location. Click Cancel if you did not make any changes. Select File > Save to save any changes you made to the WSDL file. Repeat the same steps for the second wsdl file, located in CreditService > Web Content > WEB-INF\wsdl. Close both files in the editor.
Right-click WebServices.deploy (located in SOADEMO > CreditService > Resources) and select Properties. This displays the WAR Deployment Profile Properties dialog.
WAR Deployment Profile Properties Dialog, General Section
Figure 513
2. 3. 4.
Select General on the left side. On the right side, select Specify J2EE Web Context Root and enter CreditService as its value. Click OK. Select File > Save to save your changes.
Expand CreditService > Resources and right-click WebServices.deploy. Select Deploy to and your application server connection. In the Configure Application dialog, click OK.
After deploying CreditService, you can enter the following URL in a browser to see the WSDL for CreditService: http://hostname:port/CreditService/ValidateCreditCardServiceSoap Http?WSDL For hostname, specify the name of the machine running Oracle Application Server. For port, specify the HTTP port at which Oracle Application Server is listening. This is either the Oracle HTTP Server port or the OC4J port. After deploying CreditService, you should see it in two places in the Application Server Control: in the Web Services tab (Figure 514) and the Applications tab (Figure 515) of the OC4J:home page.
Figure 514 Web Services Tab of OC4J:home Page Showing the ValidateCreditCardServiceSoapHttp Web Service
5-10
Figure 515 Applications Tab of OC4J:home Page Showing the SOADEMO-CreditService-WS Application
5-11
5-12
6
Creating the RapidService Project
This chapter describes how to create the RapidService project. It contains these sections:
Section 6.1, "About the RapidService Project" Section 6.2, "Create a New Project for RapidService" Section 6.3, "Add JSR-181 Library to the RapidService Project" Section 6.4, "Create Item.java" Section 6.5, "Create Quote.java" Section 6.6, "Create RequestQuote.java" Section 6.7, "Check Files in the Application Navigator" Section 6.8, "Compile the Files" Section 6.9, "Publish the Project as a Web Service" Section 6.10, "Verify the Hostname and Port in the Generated WSDL File" Section 6.11, "Check Files in the Application Navigator" Section 6.12, "Set the Context Root to RapidService" Section 6.13, "Edit the Deployment Descriptor" Section 6.14, "Deploy the RapidService Project" Section 6.15, "View the WSDL for RapidService"
6-1
1. 2.
Right-click the SOADEMO application, and select New Project. In the New Gallery, in the Categories section, expand General and select Projects. In the Items section, select Empty Project.
Click OK.
3.
In the Create Project dialog, enter RapidService in the Project Name field.
Click OK. In the Application Navigator, you should see an empty RapidService project located under the SOADEMO application.
4.
Right-click the RapidService project and select Project Properties. In the Project Properties dialog, select Libraries on the left side.
6-2
2. 3.
Click Add Library. In the Add Library dialog, select JSR-181 Web Services, located under Extension.
4.
Click OK in the Add Library dialog. In the Project Properties dialog, you should see the JSR-181 library added to the list.
6-3
Create Item.java
5. 6.
Click OK in the Project Properties dialog. Select the RapidService project in the Application Navigator and select File > Save to save your work.
Right-click the RapidService project, and select New. In the New Gallery, in the Categories section, expand General and select Simple Files. In the Items section, select Java Class.
6-4
Create Item.java
Name: enter Item. Package: enter org.soademo.rapidservice.types. Extends: enter java.lang.Object. Public: select this option. Generate Default Constructor: select this option. Generate Main Method: do not select.
6-5
Create Quote.java
Right-click the RapidService project, and select New. In the New Gallery, in the Categories section, expand General and select Simple Files. In the Items section, select Java Class.
Name: enter Quote. Package: enter org.soademo.rapidservice.types. Extends: enter java.lang.Object. Public: select this option. Generate Default Constructor: select this option. Generate Main Method: do not select.
6-6
Create RequestQuote.java
4.
Right-click the RapidService project, and select New. In the New Gallery, in the Categories section, expand General and select Simple Files. In the Items section, select Java Class.
6-7
Create RequestQuote.java
Name: enter RequestQuote. Package: enter org.soademo.rapidservice. Note that this is different from the previous Java classes you created. Extends: enter java.lang.Object. Public: select this option. Generate Default Constructor: select this option. Generate Main Method: do not select.
Create Java Class Dialog for RequestQuote.java
Figure 610
6-8
package org.soademo.rapidservice; import javax.jws.WebMethod; import javax.jws.WebService; import org.soademo.rapidservice.types.Item; import org.soademo.rapidservice.types.Quote; @WebService(serviceName="RapidService", targetNamespace="http://www.globalcompany.com/ns/rapidservice") public class RequestQuote { public RequestQuote() { } @WebMethod(operationName="OrderQuote") public Quote processRequestQuote(String productName, String itenType, String partnum, String quantity, String price) { Quote priceQuote = new Quote(); priceQuote.setSupplierName("RapidDistributors"); priceQuote.setSupplierPrice("5000"); return priceQuote; } @WebMethod(operationName="POItemsQuote") public Quote processQuote(Item[] items){ Long totalPrice = new Long(0); for ( int i=0; i<items.length; i++) { Item localItem = items[i]; totalPrice += localItem.getQuantity()*110; } Quote priceQuote = new Quote(); priceQuote.setSupplierName("RapidDistributors"); priceQuote.setSupplierPrice(totalPrice.toString()); return priceQuote; } } 4.
6-9
Figure 611
Right-click the RapidService project, and select New. In the New Gallery, in the Categories section, expand Business Tier and select Web Services. In the Items section, select Java Web Service.
New Gallery for Generating Java Web Services
Figure 612
Click OK. This displays the Create J2EE Web Service Version dialog.
2.
In the Select J2EE Web Service Version dialog, select J2EE 1.4 (JAX-RPC) Web Service and click OK.
6-10
Figure 613
This launches the Create Java J2EE 1.4 Web Service wizard. Click Next to start.
3.
In Step 1, Class:
Web Service Name: enter RapidService. Component to Publish: select org.soademo.rapidservice.RequestQuote from the dropdown. Autogenerate Service Endpoint Interface: select this option (should be automatically selected for you). Service Endpoint Interface: select org.soademo.rapidservice.RequestQuotePortType (this should be entered for you automatically). SOAP 1.1 Binding: select this option. SOAP 1.2 Binding: do not select. WSIF Binding: do not select. Generate annotations into class: select this option.
Create Java J2EE 1.4 Web Service Wizard: Step 1, Class
Figure 614
Click Next.
4.
SOAP Message Format: select Document/Wrapped. Enable REST Access to SOAP Ports: do not select.
Generate Schema with Qualified Elements: select this option. Use DIME Encoding: do not select.
Create Java J2EE 1.4 Web Service Wizard: Step 2, Message Format
Figure 615
Click Next.
5.
Figure 616 Create Java J2EE 1.4 Web Service Wizard: Step 3, Specify Custom Data Type Serializers
6.
6-12
Figure 617
7.
Figure 618
Click Next.
8.
Figure 619
Create Java J2EE 1.4 Web Service Wizard: Step 6, Handler Details
9.
Figure 620
6-14
Figure 621
Create Java J2EE 1.4 Web Service Wizard: Step 8, Additional Classes
JDeveloper displays the RapidService.wsdl file in the editor. RapidService.wsdl is one of the files created by the wizard. Continue with the next section to see the files JDeveloper created.
6.10 Verify the Hostname and Port in the Generated WSDL File
Verify that the hostname and port in the RapidService.wsdl file are correct.
1.
If RapidService.wsdl is not displayed in the editor, double-click it in the Application Navigator. The file is located under RapidService > Web Content > WEB-INF\wsdl. Under Services, expand RequestQuoteSoapHttpPort.
RapidService.wsdl
2.
Figure 622
3. 4.
Right-click soap:address and select Properties. This displays the soap:address Properties dialog. In the soap:address Properties dialog, verify that the hostname and port are correct. The hostname specifies the name of the machine running Oracle Application Server, and the port specifies the HTTP port at which Oracle HTTP Server or OC4J is listening.
Figure 623
5.
Select View > Structure to display the Structure window. In the Application Navigator, select SOADEMO > RapidService > Application Sources > org.soademo.rapidservice > RapidService. In the Structure window, you should see the following files:
Figure 624
3.
Expand the SOADEMO > RapidService > Web Content node in the Application Navigator to see the other files that JDeveloper created. See Figure 624.
2. 3.
On the left side, select J2EE Application. Set the value of J2EE Web Application Name and J2EE Web Context Root to RapidService.
Project Properties Dialog for RapidService
Figure 625
4. 5.
Double-click the deployment descriptor (Resources > WebServices.deploy) to display the WAR Deployment Profile Properties dialog. Select General on the left side. Set Enterprise Application Name to RapidService.
Figure 626
4. 5.
6-18
6-20
7
Creating the SelectManufacturer Project
This chapter describes how to create the SelectManufacturer project. It contains these sections:
Section 7.1, "About the SelectManufacturer Project" Section 7.2, "Create a New BPEL Project for SelectManufacturer" Section 7.3, "Create "SelectService" Partner Link" Section 7.4, "Define Variables for the SelectManufacturer Project" Section 7.5, "Receive Order Data from the Client through a Receive Activity" Section 7.6, "Assign Values to be Returned" Section 7.7, "Return Values to the Client Using an Invoke Activity" Section 7.8, "Deploy the BPEL Process"
Right-click the SOADEMO application in the Application Navigator and select New Project to display the New Gallery. In the New Gallery, under Categories, expand General and select Projects. Under Items, select BPEL Process Project.
7-1
Name: enter SelectManufacturer. Namespace: enter http://www.globalcompany.com/ns/selectservice. Use Default Project Settings: select this option. Template: select Empty BPEL Process.
Click Finish.
7-2
Copy the SelectManufacturer\bpel\SelectManufacturer.wsdl file from the soademo_101310_prod.zip file to the SOADEMO\SelectManufacturer\bpel directory. Select View > Component Palette to display the Component Palette. You need the Component Palette to drag and drop BPEL activities and services onto the SelectManufacturer BPEL flow you are about to create. Select Services from the dropdown in the Component Palette. Drag the Partner Link icon from the Component Palette and drop it on a Services swimlane. You can drop it on either the left side or the right side. In the Partner Link dialog:
2.
3. 4. 5.
Name: enter SelectService. WSDL: click the Service Explorer icon (the second one from the left) to display the Service Explorer dialog. In the Service Explorer dialog, expand Project WSDL Files and select SelectManufacturer.wsdl.
Partner Link Type: select SelectService_PL (automatically filled in for you). Partner Role: select SelectServiceRequester. My Role: select SelectServiceProvider.
7-3
6.
Double-click the SelectManufacturer scope to display the Process dialog. You can double-click the "SelectManufacturer" text that is displayed sideways. In the Process dialog, click the Variables tab.
7-4
3.
Click Create to display the Create Variable dialog. In the Create Variable dialog, set these values: Name: enter inputVariable. Type: select Message Type, and click the flashlight icon. This displays the Type Chooser dialog. In the Type Chooser, select Type Explorer > Message Types > Partner Links > SelectService > SelectManufacture.wsdl > Message Types > RequestQuote_processRequestQuote.
Click OK in the Type Chooser. The Create Variable dialog now looks like this:
7-5
c. 4.
Click OK in the Create Variable dialog. This returns you to the Process dialog. You should see the inputVariable in the dialog.
Click Create to display the Create Variable dialog. In the Create Variable dialog, set these values: Name: enter outputVariable. Type: select Message Type, and click the flashlight icon. This displays the Type Chooser dialog. In the Type Chooser, select Type Explorer > Message Types > Partner Links > SelectService > SelectManufacture.wsdl > Message Types > RequestQuote_processRequestQuoteResponse.
7-6
Click OK in the Type Chooser. The Create Variable dialog now looks like this:
Figure 710 Create Variable Dialog for outputVariable
c. 5.
Figure 711
6. 7.
Click OK in the Process dialog. Select File > Save to save your work.
7.5 Receive Order Data from the Client through a Receive Activity
Create a receive activity as the starting point for this BPEL process. The receive activity receives requests from clients (in this case, the client is the SOAOrderBooking project, which is another BPEL process), and the requests can contain parameters.
1.
7-7
2. 3.
Drag the Receive activity icon from the Component Palette and drop it in the "Drop Activity Here" box on the page. Drag an arrow from the newly created receive activity and drop it on the SelectService partner link. As you drag, you should see a line connecting the receive activity with partner link. When you release, JDeveloper displays the Receive dialog. In the Receive dialog:
4.
Name: enter Receive_1. Partner Link: should be set to SelectService. This should be filled in automatically for you. Operation: should be set to processRequestQuote. This should be filled in automatically for you. Variable: click the Browse Variables icon (the icon on the right) to display the Variable Chooser dialog. Select inputVariable.
Variable Chooser Dialog
Figure 712
7-8
Figure 713
Receive Dialog
5.
Click OK in the Receive dialog. The SelectManufacturer.bpel page now contains a link from the SelectService partner link to the receive activity.
Figure 714 SelectManufacturer.bpel Showing Link from SelectService Partner Link to the Receive Activity
6.
its name ("SelectDistributors") the quote for the order. Select Manufacturer simply returns 120 multiplied by the number of items in the order to get the quote.
These values are set in the outputVariable variable, which will be returned to the client.
1.
2. 3. 4. 5.
Drag the Assign activity icon from the Component Palette and drop it after the Receive_1 activity. Double-click the new Assign instance to display the Assign dialog. Click the Copy Operation tab in the Assign dialog. In the Copy Operation tab, create the first copy operation. This copy operation sets the quote value to return.
a. b.
Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog. In the Create Copy Operation dialog: On the From side, select Expression from the Type dropdown. Enter the following into the Expression box:
120 * bpws:getVariableData('inputVariable','parameters', '/client:processRequestQuoteElement/client:param0/client:quantity')
This formula multiplies the number of items in the order by 120 to get the quote price. On the To side, select Variable from the Type dropdown. Select Variables > Process > Variables > outputVariable > parameters > client:processRequestQuoteResponseElement > client:return > client:supplierPrice. Note that the prefix ("client") may be different on your machine.
c. 6.
Create the second copy operation. This copy operation sets the name to return.
7-10
a. b.
Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog. In the Create Copy Operation dialog: On the From side, select Expression from the Type dropdown. Enter the following into the Expression box:
string('SelectDistributors')
On the To side, select Variable from the Type dropdown. Select Variables > Process > Variables > outputVariable > parameters > client:processRequestQuoteResponseElement > client:return > client:supplierName.
c.
Click OK in the Create Copy Operation dialog. The Assign dialog should look like this:
7-11
Figure 717
Assign Dialog
7. 8.
Click OK in the Assign dialog. Select File > Save to save your work.
Select Process Activities from the dropdown in the Component Palette. Drag the Invoke activity icon from the Component Palette and drop it after the Assign_1 activity. Drag an arrow from the newly created invoke activity and drop it on the SelectService partner link. This displays the Invoke dialog. In the Invoke dialog:
7-12
Name: enter Invoke_1. Partner Link: should be set to SelectService. Operation: select processRequestQuoteResponse. This is set for you automatically. Input Variable: click the Browser Variables icon (the one on the right) to display the Variable Chooser. In the Variable Chooser, select Variables > Process > Variables > outputVariable.
Variable Chooser for the Input Variable
Figure 719
Click OK in the Variable Chooser. The Invoke dialog should now look like this:
Figure 720 Invoke Dialog
5. 6.
Click OK in the Invoke dialog. Select File > Save to save your work.
7-13
Figure 721
Double-click build.properties, located under SelectManufacturer > Resources in the Application Navigator. This file defines values that are used by build.xml when you deploy the BPEL project. Uncomment (by removing the # character) these lines in the build.properties file:
platform=ias_10g domain=default rev=1.0 admin.user=oc4jadmin admin.password=welcome99 http.hostname=myAppServerMachine.mydomain.com http.port=8888 j2ee.hostname=myAppServerMachine.mydomain.com rmi.port=23793 opmn.requestport=6005 oc4jinstancename=home
2.
3.
Edit the values as necessary. The values in bold italics are the typical values you need to modify. To determine the value for rmi.port, run:
ORACLE_HOME\opmn\bin\opmnctl status -l
ORACLE_HOME specifies the Oracle home for Oracle Application Server. To determine the value for opmn.requestport, see step 6 on page 2-11.
4.
7-14
5. 6. 7.
Right-click build.xml (located under SelectManufacturer > Resources) and select Run Ant. In the Run Ant dialog, click the Properties tab. In the Property Files section, click Add. In the Add Ant Property File dialog, select the build.properties file in the SelectManufacturer directory and click Open. The Run Ant dialog should look like this:
Figure 722
8.
Click OK. JDeveloper runs Ant to compile and deploy the project. If you get errors, see the next section, Section 7.8.1, "Deploying Using Ant from the Developer Prompt".
On the machine running Oracle Application Server, select Start > Programs > Oracle - instanceName > Oracle BPEL Process Manager > Developer Prompt. This displays a shell window configured for Oracle BPEL Process Manager. Note that you must run ant from the Developer Prompt shell window to deploy the SelectManufacturer project. Running ant from a regular operating system shell for deploying the project is not supported.
2.
In the Developer Prompt window, change directory to the SOADEMO\SelectManufacturer directory, where SOADEMO refers to the directory where you created the SOA Order Booking application.
> cd SOADEMO > cd SelectManufacturer
7-15
If you are running JDeveloper and Oracle Application Server on separate machines, you can copy the SelectManufacturer directory from the JDeveloper machine to the Oracle Application Server machine. You can place it anywhere on the Oracle Application Server machine. In the Developer Prompt, you can just navigate to that directory.
3.
Run ant.
> ant
7-16
8
Creating the SOAOrderBooking Project
This chapter describes how to create the SOAOrderBooking project, which is a BPEL project. It contains these sections:
Section 8.1, "About the SOAOrderBooking Project" Section 8.2, "Create a New BPEL Project for SOAOrderBooking" Section 8.3, "Copy Files" Section 8.4, "Define Variables for the SOAOrderBooking Project" Section 8.5, "Create "client" Partner Link" Section 8.6, "Receive Input from the Client (Receive Activity)" Section 8.7, "Insert Order Information in the Database ("InsertOrderIntoDB" Scope)" Section 8.8, "Retrieve Information About the Customer ("CustomerService" Scope)" Section 8.9, "Verify the Customers Credit Card ("CreditService" Scope)" Section 8.10, "Set up Oracle Business Rules" Section 8.11, "Determine If an Order Requires Manual Approval ("RequiresManualApproval" Decide Activity)" Section 8.12, "Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)" Section 8.13, "Handle the Managers Response ("requiresApproval" Switch)" Section 8.14, "Choose a Supplier ("SelectSupplier" Scope)" Section 8.15, "Determine the Shipping Method ("PostFulfillmentReq" Scope)" Section 8.16, "Set the Order Status to "Completed" ("SetFinalOrderStatus" Scope)" Section 8.17, "Send an Email Notification to the Customer ("NotifyCustomer" Scope)" Section 8.18, "Call Back the Client ("callbackClient" Invoke Activity)" Section 8.19, "Add a Catch Branch to the Project" Section 8.20, "Deploy the Project"
services at the appropriate times. For example, it contacts CreditService to check the customers credit card, and if the credit card is acceptable, it contacts the suppliers (Select Manufacturer and Rapid Distributors) to get price quotes for the order. The SOAOrderBooking project is a large project. This chapter begins by giving an overview of the major blocks in the project, then it goes into detail for each block.
Receive activity This activity receives incoming requests, which include the order information. Scope Scope Scope Decision This scope inserts the order information into the database. This scope retrieves the customers information from the database. This scope verifies that the customer has acceptable credit. This scope is a decide activity: it consults the rules set up in a rules repository to determine whether or not an order needs to be approved by a manager. The manager can approve or reject the order. This switch checks whether the manager approved or rejected the order, and performs the appropriate activities. For approved orders, it just continues with the rest of the activities in this SOAOrderBooking project. For rejected orders, it throws a fault and does not continue.
requiresApproval
Switch
SelectSupplier
Scope
This scope selects which supplier (Select Manufacturer or Rapid Distributors) gets to fulfill the order. This scope calls the FulfillmentESB project, which determines the shipping method for the order. This scope writes the final order status in the database. This scope is an email service. It sends out email to the customers informing them that their orders have been processed successfully. This invoke activity notifies the client that it is done.
PostFulfillmentReq
Scope
SetFinalOrderStatus NotifyCustomer
Scope Scope
callbackClient
Invoke activity
8-2
Right-click the SOADEMO application in the Application Navigator and select New Project to display the New Gallery. In the New Gallery, under Categories, expand General and select Projects. Under Items, select BPEL Process Project.
Name: enter SOAOrderBooking. Namespace: enter http://www.globalcompany.com/ns/OrderBooking. Use Default Project Settings: select this option. Template: select Empty BPEL Process.
8-4
Click Finish.
In the soademo_101310_prod.zip file, these files are located in the SOAOrderBooking\bpel directory.
Double-click the SOAOrderBooking scope. You can double-click the "SOAOrderBooking" text that is displayed sideways. This displays the Process dialog.
2.
3.
Click Create to display the Create Variable dialog. In the Create Variable dialog, set these values: Name: enter inputVariable. Type: select Message Type, and click the flashlight icon. This displays the Type Chooser dialog. In the Type Chooser, select Type Explorer > Message Types > Project WSDL Files > SOAOrderBooking.wsdl > Message Types > SOAOrderBookingRequestMessage.
Click OK in the Type Chooser. The Create Variable dialog now looks like this:
8-6
c. 4.
Click OK in the Create Variable dialog. This returns you to the Process dialog. You should see the inputVariable in the dialog.
Click Create in the Process dialog to display the Create Variable dialog. In the Create Variable dialog, set these values: Name: enter outputVariable. Type: select Message Type, and click the flashlight icon. This displays the Type Chooser dialog. In the Type Chooser, select Type Explorer > Message Types > Project WSDL Files > SOAOrderBooking.wsdl > Message Types > SOAOrderBookingResponseMessage.
Click OK in the Type Chooser. The Create Variable dialog now looks like this:
Figure 88 Create Variable Dialog for outputVariable
c. 5.
6. 7.
Click OK in the Process dialog. Select File > Save to save your work.
If the Component Palette is not showing, select View > Component Palette. Select Services from the dropdown in the Component Palette.
8-8
2. 3.
Drag the Partner Link icon from the Component Palette and drop it into a Services swimlane. This displays the Create Partner Link dialog. In the Create Partner Link dialog, set these values:
Name: enter client. WSDL File: click the Service Explorer icon (second icon from the left) to display the Service Explorer dialog. In the Service Explorer dialog, expand Project WSDL Files and select SOAOrderBooking.wsdl.
Service Explorer for client Partner Link
Figure 810
Partner Link Type: select SOAOrderBooking (automatically filled in for you). Partner Role: select SOAOrderBookingRequester. My Role: select SOAOrderBookingProvider. Process: leave it blank.
Before clicking OK, check that Name is still set to client. JDeveloper may have changed it to SOAOrderBooking when it was filling in the other fields for you.
Figure 811
4. 5.
Click OK in the Create Partner Link dialog. Select File > Save to save your work.
Section 8.6.1, "Create the Receive Activity" Section 8.6.2, "Create a Sensor for the Receive Activity"
Select Process Activities from the dropdown in the Component Palette. Drag the Receive icon from the Component Palette and drop it on the page where it says "Drop Activity Here". The page should look like this at this point:
Figure 812
3.
8-10
Drag one of the arrows on the side of the Receive_1 activity and drop it on the "client" partner link. This associates the receive activity with the partner link. Double-click the new Receive_1 activity.
4.
Name: enter receiveInput. Partner Link: should be set to client. This is filled in for you if you dragged the arrow from the Receive_1 activity and dropped it on the "client" partner link. If not, click the flashlight to display the Partner Link Chooser dialog and select client.
Partner Link Chooser Dialog for "receiveInput" Receive Activity
Figure 813
Operation: select initiate. This should be filled in automatically for you. Variable: click the Browse Variables icon (the icon on the right). In the Variable Chooser dialog, select inputVariable.
8-11
Figure 814
5. 6.
Click OK in the Receive dialog. Select File > Save to save your work.
8-12
1. 2. 3. 4. 5. 6.
Double-click the "receiveInput" activity to display the Receive dialog. Click the Sensors tab in the Receive dialog. Click Create to create a new sensor. This displays the Create Activity Sensor dialog. In the Create Activity Sensor dialog, set the Name to InstanceStart. Set the Evaluation Time to Completion. This specifies when the sensor fires. Completion signifies that the sensor fires after this activity has run. In the Activity Variable Sensors section, click Create to display the Create Activity Variable Sensor dialog.
Create Activity Variable Sensor Dialog
Figure 816
7.
In the Create Activity Variable Sensor dialog, click the pencil icon for Variable XPath. This displays the Variable XPath Builder dialog.
Variable XPath Builder Dialog
Figure 817
8. 9.
Select Variables > Process > Variables > inputVariable. Click OK in the Variable XPath Builder. The Create Activity Variable Sensor dialog should be filled in with these values for you (see Figure 816): Variable XPath: $inputVariable Output Namespace: http://www.globalcompany.com/ns/OrderBooking
8-13
12. In the Sensor Action Chooser dialog, select Sensor Actions and select Sensor
Action from the wand icon. This displays the Create Sensor Action dialog.
13. In the Create Sensor Action dialog:
Name: enter InstanceStart. Publish Type: select JMS Topic. JMS Connection Factory: enter jms/TopicConnectionFactory. Publish Target: enter jms/demoTopic. Filter: leave blank. Enable: select this option.
Create Sensor Action Dialog
Figure 819
8-14
14. Click OK in the Create Sensor Action dialog. The Sensor Action Chooser dialog
15. Click OK in the Sensor Action Chooser. This takes you back to the Create Activity
In the Receive dialog, the Sensors tab now looks like this:
8-15
Figure 822
17. Click OK in the Receive dialog. 18. Select File > Save to save your work.
sensor.xml sensorAction.xml
8-16
Figure 824
In the Component Palette, select Services from the dropdown. Drag the Database Adapter icon from the Component Palette and drop it in a Services swimlane. This launches the Adapter Configuration wizard. Click Next on the welcome page to continue. In Step 1, Service Name, enter Order as the Service Name, and click Next.
3.
8-17
Figure 825
4.
In Step 2, Service Connection: Connection: select the database connection for the SOADEMO schema. JNDI Name: enter eis/DB/soademo. This is the JNDI location you specified when you created connection factory in Oracle Application Server (see Section 2.6.4, "Create a Database Adapter Connection Factory").
Adapter Configuration Wizard, Step 2, Service Connection
Figure 826
Click Next.
5.
In Step 3, Operation Type, select Perform an Operation on a Table, and select Insert or Update (Merge). The SOA Order Booking application only needs to insert rows in the table.
8-18
Figure 827
Click Next.
6.
In Step 4, Select Table, click Import Tables. In the Import Tables dialog, click Query. Select ORDERS and ITEMS and click the right-arrow button to move them to the Selected box. The database adapter will write to these tables.
Figure 828
Click OK in the Import Tables dialog. Step 4, Select Table, now looks like this:
8-19
Figure 829
7. 8.
Figure 830
9.
10. JDeveloper displays the Create Partner Link dialog with the fields filled in:
8-20
Figure 831
Click OK in the Create Partner Link dialog. You should see the "Orders" database adapter in the Services swimlane.
11. Select File > Save to save your work.
bpel\DBAdapterOutboundHeader.wsdl -- this file contains generic information for connecting to a database. bpel\Order.wsdl -- this file contains the information that you specified in the wizard. bpel\Order_table.xsd -- this file contains the schema information for the ORDERS and ITEMS tables. bpel\Order_toplink_mappings.xml -- this file is used by TopLink src\Order\Orders.java src\Order\Items.java database\SOADEMO\ORDERS.table database\SOADEMO\ITEMS.table toplink\Order\Order.mwp
8.7.2 Create a Database Adapter for Retrieving the Order ID from the Database
Before you can insert order information in the ORDERS table in the database, you need to retrieve the order ID from the database. The order ID is generated from a database sequence.
1. 2.
In the Component Palette, select Services from the dropdown. Drag the Database Adapter icon from the Component Palette and drop it in a Services swimlane. This launches the Adapter Configuration Wizard. Click Next on the welcome page to continue. In Step 1, Service Name, enter OrderSequence as the Service Name, and click Next.
3.
8-21
Figure 832
4.
In Step 2, Service Connection: Connection: select the database connection for the SOADEMO schema. JNDI Name: enter eis/DB/soademo. This is the JNDI location you specified when you created connection factory in Oracle Application Server (see Section 2.6.4, "Create a Database Adapter Connection Factory").
Adapter Configuration Wizard, Step 2, Service Connection
Figure 833
Click Next.
5.
8-22
Figure 834
Click Next.
6.
In Step 4, Custom SQL, enter the following SQL statement in the SQL box: select order_seq_id_gen.nextval from dual The wizard displays the appropriate statements in the XSD box.
Figure 835
Click Next.
7. 8.
On the Finish page, click Finish. JDeveloper displays the Create Partner Link dialog with the fields filled in:
8-23
Figure 836
Click OK in the Create Partner Link dialog. You should see the OrderSequence database adapter in the Services swimlane.
9.
bpel\OrderSequence.wsdl -- this file contains the information that you specified in the wizard. bpel\OrderSequence.xsd -- this file defines the format of the sequence input and output.
In the Component Palette, select Process Activities from the dropdown. Drag the Scope icon from the Component Palette and drop it between the "receiveInput" activity and the "callbackClient" activity". Double-click the new scope to display the Scope dialog. In the Scope dialog, in the General tab:
5. 6.
Click the Variables tab. You need to create three variables for this scope: orderRequest, orderSequenceInput, orderSequenceOutput. Create the orderRequest variable:
a. b.
In the Variables tab, click Create. In the Create Variable dialog: Name: enter orderRequest. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types >
8-24
Partner Links > Order > Order.wsdl > Message Types > OrdersColllection_msg.
Figure 837 Type Chooser Dialog for orderRequest Variable
Click OK in the Type Chooser. In the Create Variable dialog, the Message Type is set to {http://xmlns.oracle.com/pcbpel/adapter/db/Order/}OrdersCollection_msg.
Figure 838 Create Variable Dialog for orderRequest Variable
c. 7.
Click OK in the Create Variable dialog. This returns you to the Scope dialog.
8-25
Name: enter orderSequenceInput. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > OrderSequence > OrderSequence.wsdl > Message Types > OrderSequenceInput_msg.
Type Chooser Dialog for orderSequenceInput Variable
Figure 839
Click OK in the Type Chooser. In the Create Variable dialog, the Message Type is set to {http://xmlns.oracle.com/pcbpel/adapter/db/OrderSequence/}OrderSequenceInput_msg.
Figure 840 Create Variable Dialog for orderSequenceInput Variable
c. 8.
Click OK in the Create Variable dialog. This returns you to the Scope dialog.
8-26
a. b.
In the Variables tab, click Create. In the Create Variable dialog: Name: enter orderSequenceOutput. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > OrderSequence > OrderSequence.wsdl > Message Types > OrderSequenceOutputCollection_msg.
Type Chooser Dialog for orderSequenceOutput Variable
Figure 841
Click OK in the Type Chooser. In the Create Variable dialog, the Message Type is set to {http://xmlns.oracle.com/pcbpel/adapter/db/OrderSequence/}OrderSequenceOutputCollection_msg.
Figure 842 Create Variable Dialog for orderSequenceOutput Variable
8-27
c.
Click OK in the Create Variable dialog. This returns you to the Scope dialog. You should see all three variables in the dialog.
Scope Dialog for InsertOrderIntoDB, Variables Tab
Figure 843
9.
8.7.4 Retrieve the Order ID from the Database Sequence ("GetOrderId" Invoke Activity)
This invoke activity retrieves the next value from the order_seq_id_gen database sequence and stores it in the orderSequenceOutput variable.
1. 2. 3.
Expand the "InsertOrderIntoDB" scope. Drag the Invoke icon from the Component Palette and drop it in the "InsertOrderIntoDB" scope. Do one of the following to display the Invoke dialog:
Drag one of the arrows on the side of the "Invoke_1" activity and drop it on the "OrderSequence" database adapter. This associates the invoke activity with the database adapter. Double-click the new Invoke_1 activity.
4.
Name: enter GetOrderId. Partner Link: should be set to OrderSequence. If not, click the flashlight and select OrderSequence from the Partner Link Chooser.
8-28
Figure 844
Operation: select OrderSequence. Input Variable: click the Browse Variables icon (the second icon from the left) and select Process > Variables > Scope - InsertOrderIntoDB > Variables > orderSequenceInput.
Variable Chooser Dialog for Input Variable for "GetOrderId" Invoke Activity
Figure 845
Output Variable: click the Browse Variables icon (the second icon from the left) and select Process > Variables > Scope - InsertOrderIntoDB > Variables > orderSequenceOutput.
Creating the SOAOrderBooking Project 8-29
Figure 846
Variable Chooser Dialog for Output Variable for "GetOrderId" Invoke Activity
Click OK in the Variable Chooser. The Invoke dialog should look like this:
Figure 847 Invoke Dialog for "GetOrderId" Invoke Activity
5. 6.
Click OK in the Invoke dialog. Select File > Save to save your work.
8-30
Figure 848
SOAOrderBooking.bpel Page
8.7.5 Prepare the Order ID and Order Status Information ("AssignOrderStatus" Assign Activity)
This assign activity prepares two values for insertion into the database:
It invokes the order_seq_id_gen database sequence to get the order ID. It sets the order status to "pending".
These values are used by the "InsertOrder" invoke activity when it writes the order information to the database. To create this assign activity:
1. 2. 3. 4. 5.
Drag the Assign activity icon from the Component Palette and drop it below the "GetOrderId" activity in the "InsertOrderIntoDB" scope. Double-click the new assign activity to display the Assign dialog. In the Assign dialog, click the General tab, and set the Name to AssignOrderStatus. Still in the Assign dialog, click the Copy Operation tab and create two copy operations: one to copy the order ID and another one to copy the order status. Create the copy operation to copy the order ID:
a. b.
Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog. In the From side, set Type to Variable, and select Variables > Process > Scope - InsertOrderIntoDB > Variables > orderSequenceOutput > OrderSequenceOutputCollection > ns4:OrderSequenceOutputCollection > ns4:OrderSequenceOutput > ns4:order_seq_id_gen.nextval. In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:ID.
c.
8-31
Figure 849 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Copy the Order ID
d. 6.
Select Copy Operation from the Create dropdown again to create the second copy operation. This displays the Create Copy Operation dialog. In the From side, set Type to Expression, and enter the following line in the Expression box:
string('pending')
c.
In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:OrderInfo > ns1:OrderStatus.
8-32
Figure 850 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Copy the Order Status
d. 7.
You should see two copy operations in the Assign dialog. Click OK.
Assign Dialog for "AssignOrderStatus" Activity
Figure 851
8.
8-33
Figure 852
SOAOrderBooking.bpel Page
In the Component Palette, select Process Activities from the dropdown. Drag the Transform icon from the Component Palette and drop it after the "AssignOrderStatus" activity. Double-click the new transform activity to display the Transform dialog. In the Transform dialog, click the General tab and set the Name to TransformOrder. Click the Transformation tab in the dialog and set these values:
Source Variable: select inputVariable. The Source Part should be set to payload. Target Variable: select orderRequest. The Target Part should be set to OrdersCollection. Mapper File: enter TransformOrder.xsl and click the Create Mapping icon (the middle icon). This displays the Data Mapping tool for TransformOrder.xsl. In the Data Mapping tool, create the simple mappings shown in Table 82. The left column shows the source side and the right column shows the target side. You create the simple mappings by dragging and dropping the labels from the source side to the target side.
8-34
Table 82
Simple Mappings
Source > client:SOAOrderBookingProcessRequest > po:PurchaseOrder Target > OrdersCollection > Orders po:CustID po:ID po:OrderInfo > po:OrderDate po:OrderInfo > po:OrderPrice po:OrderInfo > po:OrderStatus custid ordid orderdate price status
Figure 853 shows the Data Mapper with the simple mappings done.
Figure 853 Data Mapper for Transform Activity in InsertOrderIntoDB Scope
Process all the items in the order by creating a "for-each" element in the XSL file: a. Select XSLT Constructs from the dropdown in the Component Palette in the Data Mapper. b. On the target side, expand itemsCollection and Items. c. Drag the for-each item from the Component Palette and drop it on Items. You want the for-each label to show up between itemsCollection and Items on the target side. d. Expand po:OrderItems on the source side to that you can see po:Item below it. Expand po:Item as well. e. Drag a line from po:Item on the source side to the for-each item on the target side. f. Map the following item fields:
8-35
Table 83
Source > client:SOAOrderBookingP rocessRequest > po:PurchaseOrder > Target > OrdersCollection > Orders > itemsCollection > po:OrderItems > po:Item for-each > Items po:ProductName po:partnum po:price po:Quantity productname partnum price quantity
For itemid on the target side, you want to map it to the position() function. To do this in the Data Mapper: a. Select Node-set Functions from the dropdown in the Component Palette. b. Drag the position item from the Component Palette and drop it in the middle area (between the source and target areas). c. Drag a line from itemid on the target side to the position item in the middle area. d. Select File > Save to save TransformOrder.xsl. Figure 854 shows the complete transformation in the Data Mapper.
Figure 854 Data Mapper Showing Complete Mappings for the Transformation Activity
e. Select File > Close to close TransformOrder.xsl. This takes you back to the main editor in JDeveloper.
6.
8.7.7 Insert the Order Information into the Database ("InsertOrder" Invoke Activity)
This invoke activity inserts the data into the database.
1.
8-36
2. 3.
Drag the Invoke icon from the Component Palette and drop it below the "TransformOrder" activity. Do one of the following to display the Invoke dialog:
Drag one of the arrows on the side of the Invoke_1 activity and drop it on the "Order" database adapter. This associates the Invoke_1 activity with the database adapter. Double-click the new Invoke_1 activity.
4.
Name: enter InsertOrder. Partner Link: should be set to Order. If not, click the flashlight and select Order from the Partner Link Chooser.
Partner Link Chooser for "InsertOrder" Invoke Activity
Figure 855
Operation: select write. Input Variable: click the Browse Variables icon (the second icon from the left) and select Variables > Process > Scope - InsertOrderIntoDB > Variables > orderRequest.
8-37
Figure 856
Variable Chooser Dialog for Input Variable for "InsertOrder" Invoke Activity
Click OK in the Variable Chooser. The Invoke dialog should look like this:
Figure 857 Invoke Dialog for "InsertOrder" Invoke Activity
5. 6.
Click OK in the Invoke dialog. Select File > Save to save your work.
8-38
Figure 858
SOAOrderBooking.bpel Page
8-39
Figure 859
Copy the following file from the soademo_101310_prod.zip file to the SOAOrderBooking\bpel directory.
CustomerSvc.wsdl
In the soademo_101310_prod.zip file, the CustomerSvc.wsdl file is located in the SOAOrderBooking\bpel directory.
2.
In JDeveloper, select File > Open and open the CustomerSvc.wsdl file. Click the Source tab at the bottom of the editor to view the lines in the file. The http://localhost:8888 reference in the file assumes that Oracle Application Server is running on the same machine as JDeveloper, and that Oracle Application Server is listening for requests on port 8888. If necessary, change localhost to the name of the machine running Oracle Application Server, and 8888 to the correct port used by your Oracle Application Server installation, for example: mypc.mydomain.com:8889.
d. 3. 4. 5.
If you edited the file, save the file and close it.
In the Component Palette, select Services from the dropdown. Drag the Partner Link icon from the Component Palette and drop it in a Services swimlane. In the Create Partner Link dialog:
8-40
WSDL File: click the Service Explorer icon (second icon from the left) to display the Service Explorer dialog. In the Service Explorer dialog, expand Project WSDL Files and select CustomerSvc.wsdl.
Service Explorer for "CustomerService" Partner Link
Figure 860
Partner Link Type: select CustomerService_PL (automatically filled in for you). Partner Role: select CustomerService_Role. My Role: leave it blank.
Before clicking OK, check that the Name is CustomerService. JDeveloper may have changed it CustomerSvc. Click OK in the Create Partner Link dialog.
8-41
In the Component Palette, select Process Activities from the dropdown. Drag the Scope icon from the Component Palette and drop it below the "InsertOrderIntoDB" scope. Double-click the new scope to display the Scope dialog. In the Scope dialog, in the General tab:
5. 6. 7.
Click the Variables tab. You need to create a variable for this scope. In the Variables tab, click Create. In the Create Variable dialog:
Name: enter customerServiceRequest. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > CustomerService > CustomerSvc.wsdl > Imported WSDL > CustomerService > Message Types > CustomerService_findCustomerById.
Type Chooser Dialog for "customerServiceRequest" Variable
Figure 862
In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/customer}CustomerService_ findCustomerById.
8-42
Figure 863
9.
Figure 864
Expand the CustomerService scope. Drag the Assign activity icon from the Component Palette and drop it in the CustomerService scope. Double-click the new assign activity to display the Assign dialog.
8-43
4. 5. 6.
In the Assign dialog, click the General tab, and set the Name to AssignRequest. Still in the Assign dialog, click the Copy Operation tab. Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog. In the From side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:CustID. In the To side, set Type to Variable, and select Variables > Process > Scope Customer Service > Variables > customerServiceRequest > parameters > ns8:findCustomerById > ns8:custid.
Create Copy Operation Dialog for "AssignRequest" Activity
Figure 865
You should see the copy operation in the Assign dialog. Click OK.
8-44
Figure 866
8.8.4 Create a Variable to Contain the Results of findCustomerById ("customerServiceResponse" Process Variable)
The customerServiceResponse variable is used to contain the results of the findCustomerById operation. Create the customerServiceResponse variable in the SOAOrderBooking scope. The variable is created at this level so that any activity in this BPEL process can access it.
1. 2. 3.
Double-click the SOAOrderBooking scope. You can double-click the "SOAOrderBooking" text that is sideways. This displays the Process dialog. In the Process dialog, click Create in the Variables tab. This displays the Create Variable dialog. In the Create Variable dialog:
Name: enter customerServiceResponse. Type: select Message Type, and click the flashlight icon. This displays the Type Chooser dialog. In the Type Chooser, select Type Explorer > Message Types > Partner Links > CustomerService > CustomerSvc.wsdl > Imported WSDL > Customer Service > Message Types > CustomerService_findCustomerByIdResponse.
8-45
Figure 867
Click OK in the Type Chooser. The Create Variable dialog now looks like this:
Figure 868 Create Variable Dialog for "customerServiceResponse" Process Variable
4.
Click OK in the Create Variable dialog. The customerServiceResponse variable appears in the Process dialog.
8-46
Figure 869
5. 6.
Click OK in the Process dialog. Select File > Save to save your work.
Drag the Invoke icon from the Component Palette and drop it below the "AssignRequest" activity. Do one of the following to display the Invoke dialog:
Drag one of the arrows on the side of the Invoke_1 activity and drop it on the "CustomerService" partner link. This associates the invoke activity with the partner link. Double-click the new Invoke_1 activity.
3.
Name: enter GetCustInfo. Partner Link: should be set to CustomerService. If not, click the flashlight and select CustomerService from the Partner Link Chooser.
8-47
Figure 870
Operation: select findCustomerById. Input Variable: click the Browse Variables icon (the second icon from the left) and select Variables > Process > Scope - CustomerService > Variables > customerServiceRequest.
Variable Chooser Dialog for the Input Variable for the "GetCustInfo" Invoke
Output Variable: click the Browse Variables icon (the second icon from the left) and select Variables > Process > Variables > customerServiceResponse.
8-48
Figure 872 Variable Chooser Dialog for the Output Variable for the "GetCustInfo" Invoke Activity
Click OK in the Variable Chooser. The Invoke dialog should look like this:
Figure 873 Invoke Dialog for the "GetCustInfo" Invoke Activity
4. 5.
Click OK in the Invoke dialog. Select File > Save to save your work.
Drag the Assign activity icon from the Component Palette and drop it below the "GetCustInfo" activity.
8-49
2. 3. 4. 5.
Double-click the new assign activity to display the Assign dialog. In the Assign dialog, click the General tab, and set the Name to AssignInitialCustomerResponse. Still in the Assign dialog, click the Copy Operation tab. You will create an append operation. Select Append Operation from the Create dropdown. This displays the Create Append Operation dialog.
In the From side, select XML Fragment from the Type dropdown, and enter the following in the XML Fragment box:
<nsx:ShipTo xmlns:nsx="http://www.globalcompany.com/ns/order"> <nsx:Name> <nsx:First/> <nsx:Last/> </nsx:Name> </nsx:ShipTo>
Note that you need to replace the nsx prefix with the prefix for "http://www.globalcompany.com/ns/order". To determine the prefix, scroll to the beginning of your SOAOrderBooking.bpel file and look for this line: xmlns:prefix="http://www.globalcompany.com/ns/order" For example, if the line in your file looks like the following:
xmlns:ns1="http://www.globalcompany.com/ns/order"
then you need to change the prefix to ns1 in the XML fragment.
In the To side, select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder.
8-50
Figure 875
8-51
8.8.7 Copy the Customers First and Last Names to the inputVariable ("AssignCustomerResponse" Assign Activity)
This assign activity assigns the first and last names of the customer (which were retrieved from the database) to the inputVariable.
1. 2. 3. 4. 5.
Drag the Assign activity icon from the Component Palette and drop it below the "AssignInitialCustomerResponse" activity. Double-click the new assign activity to display the Assign dialog. In the Assign dialog, click the General tab, and set the Name to AssignCustomerResponse. Still in the Assign dialog, click the Copy Operation tab. You will create two copy operations. Create the first copy operation: Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.
In the From side, set Type to Variable, and select Variables > Process > Variables > customerServiceResponse > parameters > ns8:findCustomerByIdResponse > ns8:return > ns8:fname. In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:ShipTo > ns1:Name > ns1:First.
Figure 876 Create Copy Operation Dialog for "AssignCustomerResponse" Activity, First Copy Operation
8-52
6.
Create the second copy operation: Select Copy Operation from the Create dropdown again. This displays the Create Copy Operation dialog.
In the From side, set Type to Variable, and select Variables > Process > Variables > customerServiceResponse > parameters > ns8:findCustomerByIdResponse > ns8:return > ns8:lname. In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:ShipTo > ns1:Name > ns1:Last.
Figure 877 Create Copy Operation Dialog for "AssignCustomerResponse" Activity, Second Copy Operation
You should see two copy operations in the Assign dialog. Click OK.
8-53
Figure 878
8.
8-54
Figure 879
Copy the following file from the soademo_101310_prod.zip file to the SOAOrderBooking\bpel directory.
CreditValidatingService.wsdl
In the soademo_101310_prod.zip file, the CreditValidatingService.wsdl file is located in the SOAOrderBooking\bpel directory.
2.
In JDeveloper, select File > Open and open the CreditValidatingService.wsdl file. Click the Source tab at the bottom of the editor to view the lines in the file. The http://localhost:8888 reference in the file assumes that Oracle Application Server is running on the same machine as JDeveloper, and that Oracle Application Server is listening for requests on port 8888.
8-55
If necessary, change localhost to the name of the machine running Oracle Application Server, and 8888 to the correct port used by your Oracle Application Server installation, for example: mypc.mydomain.com:8889.
d. 3. 4. 5.
If you edited the file, save the file and close it.
In the Component Palette, select Services from the dropdown. Drag the Partner Link icon from the Component Palette and drop it in a Services swimlane. In the Create Partner Link dialog:
Name: enter CreditValidatingService. WSDL File: click the Service Explorer icon (second icon from the left) to display the Service Explorer dialog. In the Service Explorer dialog, expand Project WSDL Files and select CreditValidatingService.wsdl.
Service Explorer Dialog for "CreditValidatingService" Partner Link
Figure 880
Partner Link Type: select ValidateCreditCard_PL (automatically filled in for you). Partner Role: select ValidateCreditCard_Role. My Role: leave it blank.
8-56
Figure 881
In the Component Palette, select Process Activities from the dropdown. Drag the Scope icon from the Component Palette and drop it below the "CustomerService" scope. Double-click the new scope to display the Scope dialog. In the Scope dialog, in the General tab:
5. 6. 7.
Click the Variables tab. You need to create two variables for this scope. In the Variables tab, click Create. In the Create Variable dialog:
Name: enter validateRequest. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > CreditValidatingService > CreditValidatingService.wsdl > Imported WSDL > ValidateCreditCardServiceSoapHttp > Message Types > CreditCardValidationRequestMessage.
8-57
Figure 882
In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/credit}CreditCardValidationR equestMessage.
Create Variable Dialog for the "validateRequest" Variable
Figure 883
9.
10. Click Create again to create a second variable. 11. In the Create Variable dialog:
Name: enter validateResponse. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > CreditValidatingService > CreditValidatingService.wsdl > Imported WSDL
8-58
{http://www.globalcompany.com/ns/credit}CreditCardValidationR esponseMessage.
Figure 885 Create Variable Dialog for the "validateResponse" Variable
13. Click OK in the Create Variable dialog. 14. The validateRequest and validateResponse variables appear in the
8-59
Figure 886
8.9.3 Assign the Credit Card Number and Credit Card Type Information ("InitializeRequest" Assign Activity)
This assign activity copies the credit card number and type (which were retrieved from the CustomerServices findCustomerById operation) to the validateRequest variable.
1. 2. 3. 4. 5. 6.
Expand the "CreditService" scope. Drag the Assign activity icon from the Component Palette and drop it in the "CreditService" scope. Double-click the new assign activity to display the Assign dialog. In the Assign dialog, click the General tab, and set the Name to InitializeRequest. Still in the Assign dialog, click the Copy Operation tab. You will create two copy operations. Create the first copy operation: Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.
In the From side, set Type to Variable, and select Variables > Process > Variables > customerServiceResponse > parameters > ns8:findCustomerByIdResponse > ns8:return > ns8:creditcardnumber. In the To side, set Type to Variable, and select Variables > Process > Scope Credit Service > Variables > validateRequest > CreditCard > ns11:CreditCard > ccNum.
8-60
Figure 887 Create Copy Operation Dialog for the "InitializeRequest" Activity, First Copy Operation
Create the second copy operation: Select Copy Operation from the Create dropdown again. This displays the Create Copy Operation dialog.
In the From side, set Type to Variable, and select Variables > Process > Variables > customerServiceResponse > parameters > ns8:findCustomerByIdResponse > ns8:return > ns8:creditcardtype. In the To side, set Type to Variable, and select Variables > Process > Scope Credit Service > Variables > validateRequest > CreditCard > ns11:CreditCard > ccType.
8-61
Figure 888 Create Copy Operation Dialog for the "InitializeRequest" Activity, Second Copy Operation
You should see the copy operations in the Assign dialog. Click OK.
Assign Dialog for the "InitializeRequest" Activity
Figure 889
Drag the Invoke icon from the Component Palette and drop it below the "InitializeRequest" activity. Do one of the following to display the Invoke dialog:
Drag one of the arrows on the side of the Invoke_1 activity and drop it on the "CreditValidatingService" partner link. This associates the invoke activity with the partner link. Double-click the new Invoke_1 activity.
3.
Name: enter InvokeCreditService. Partner Link: should be set to CreditValidatingService. If not, click the flashlight and select CreditValidatingService from the Partner Link Chooser.
Partner Link Chooser for the "InvokeCreditService" Activity
Figure 890
Operation: select VerifyCC (should be filled in for you automatically). Input Variable: click the Browse Variables icon (the second icon from the left) and select Variables > Process > Scope - CreditService > Variables > validateRequest.
8-63
Variable Chooser Dialog for the Input Variable for the "InvokeCreditService"
Output Variable: click the Browse Variables icon (the second icon from the left) and select Variables > Process > Scope - CreditService > Variables > validateResponse.
Figure 892 Variable Chooser Dialog for the Output Variable for the "InvokeCreditService" Activity
Click OK in the Variable Chooser. The Invoke dialog should look like this:
8-64
Figure 893
4. 5.
Click OK in the Invoke dialog. Select File > Save to save your work.
Scroll to the top of the page and double-click the SOAOrderBooking scope. You can double-click the "SOAOrderBooking" text that is sideways. This displays the Process dialog. In the Process dialog, click Create in the Variables tab. This displays the Create Variable dialog. In the Create Variable dialog:
2. 3.
Name: enter OrderBookingFault. Type: select Message Type, and click the flashlight icon. This displays the Type Chooser dialog. In the Type Chooser, select Type Explorer > Message Types > Partner Links > client > SOAOrderBooking.wsdl > Message Types > SOAOrderBookingFaultMessage.
8-65
Figure 894
Click OK in the Type Chooser. The Create Variable dialog now looks like this:
Figure 895 Create Variable Dialog for the "OrderBookingFault" Process Variable
4.
Click OK in the Create Variable dialog. The OrderBookingFault variable appears in the Process dialog.
8-66
Figure 896
Process Dialog
5.
8.9.6 Check the Results of the Credit Card Validation (Switch Activity)
This switch checks the result of the "InvokeCreditService" invoke activity. If the customers credit card is valid, the flow continues. If the customers credit card is not valid, the switch throws a fault.
1. 2. 3.
Drag the Switch icon from the Component Palette and drop it below the "InvokeCreditService" activity. Expand the switch. Delete the <otherwise> case. This switch only handles invalid credit responses, for which it throws a fault. For credit cards that are valid, the switch does not apply to them and for those cases, they just continue to the next step in the flow.
Double-click the title bar of the <case> box to display the Switch Case dialog. In the Switch Case dialog, click the XPath Expression Builder icon above the Expression box to display the Expression Builder dialog. In the Expression Builder dialog, in the BPEL Variables box, select Variables > Process > Scope - CreditService > Variables > validateResponse > valid > ns11:valid. The Content Preview box should show bpws:getVariableData(validateResponse, valid, ns11:valid). The ns11 prefix maps to the "http://www.globalcompany.com/ns/credit.xsd" namespace. It may be different on your system. If you want, you can scroll to the top of your SOAOrderBooking.bpel file (in source view) to verify the prefix.
4.
Click Insert Into Expression. The Expression box should show the function with the three parameters.
8-67
5.
Append =false to the expression in the Expression box so that the expression looks like this:
bpws:getVariableData('validateResponse','valid','/ns11:valid')='false'
Figure 897
6. 7.
Click OK in the Expression Builder dialog. Click OK in the Switch Case dialog.
8.9.6.2 Set the Value of the OrderBookingFault Variable ("AssignFault" Assign Activity)
This assign activity sets the value of the OrderBookingFault variable to "credit problem".
1. 2. 3. 4. 5.
Drag the Assign activity icon from the Component Palette and drop it in the <case> area of the switch. Double-click the new assign activity to display the Assign dialog. In the Assign dialog, click the General tab, and set the Name to AssignFault. Still in the Assign dialog, click the Copy Operation tab. You will create one copy operation. Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.
In the From side, set Type to Expression, and enter the following line in the Expression box: string('credit problem')
8-68
In the To side, set Type to Variable, and select Variables > Process > Variables > OrderBookingFault > payload > client:SOAOrderBookingProcessFault > client:status.
Create Copy Operation Dialog for the "AssignFault" Activity
Figure 898
You should see the copy operation in the Assign dialog. Click OK.
Assign Dialog for the "AssignFault" Activity
Figure 899
8-69
Drag the Throw icon from the Component Palette and drop it below the "AssignFault" activity. Double-click the new throw activity to display the Throw dialog. In the Throw dialog:
Name: enter ThrowCreditFault. Namespace URI: enter http://www.globalcompany.com/ns/OrderBooking. You have to enter it manually. Local Part: enter OrderBookingFault. You have to enter it manually. Fault Variable: click the flashlight and select OrderBookingFault.
Throw Dialog for the "ThrowCreditFault" Throw Activity
Figure 8100
4. 5.
Click OK in the Throw dialog. Select File > Save to save your work.
8-70
If a customers status is platinum, then a managers approval is not required, regardless of the amount of the order. If an orders total is $1000 or more and the customers status is not platinum, then a managers approval is required. If an orders total is under $1000, then a managers approval is not required.
Create the following directory where you are building the SOA Order Booking application: SOADEMO\SOAOrderBooking\bpel\rules\oracle\ This is the directory where you will place the Oracle Business Rules repository file.
2.
In a browser, go to the Rule Author page. The URL for Rule Author is: http://host:port/ruleauthor host specifies the machine running Oracle Application Server, and port specifies the HTTP port (for example, 8888).
3. 4.
Repository Type: select File. File Location: enter SOADEMO\SOAOrderBooking\bpel\rules\oracle\sample_ repository. (SOADEMO refers to the directory where you are building the SOA Order Booking application.) Rule Author will create the sample_ repository file. If you are running JDeveloper and Oracle Application Server on different machines, enter a path on the Oracle Application Server machine, for example, C:\rules\sample_repository. It does not matter where you place it, because after creating the file and defining the rules in it, you copy it from the Oracle Application Server machine to the SOADEMO\SOAOrderBooking\bpel\rules\oracle\ directory on the JDeveloper machine.
8-71
Figure 8101
Click Create. You should see a confirmation page. Rule Author is now connected to the new repository, and you can define rules in it.
Figure 8102 Rule Author, Confirmation Page
Click the Create secondary tab on the Confirmation page. This displays the Create Dictionary page. On the Create Dictionary page, enter OrderBookingRules as the dictionary name.
8-72
Figure 8103
3. Figure 8104
8.10.4 Generate JAXB Classes for the Elements in the XML Schema
Use Rule Author to generate Java objects for the elements in the OrderBookingRules.xsd file.
1.
Click the Definitions tab, then click XMLFact on the left side. This displays the XML Fact Summary page. At this time, the OrderBookingRules dictionary does not contain any XML facts.
XML Fact Summary Page
Figure 8105
2. 3.
XML Schema: enter the fullpath to the OrderBookingRules.xsd file. If you are running JDeveloper and Oracle Application Server on the same machine, enter SOADEMO\SOAOrderBooking\bpel\OrderBookingRules.xsd. If you are running JDeveloper and Oracle Application Server on different machines, enter C:\rules\OrderBookingRules.xsd.
JAXB Class Directory: enter the fullpath to the directory where you want Rule Author to create the Java objects (.java and .class files). If you are running JDeveloper and Oracle Application Server on the same machine, enter SOADEMO\SOAOrderBooking\bpel\rules. If you are running JDeveloper and Oracle Application Server on different machines, enter C:\rules.
Target Package Name: enter com.oracle.demos.orderbooking. This specifies the package name for the classes that are to be created.
8-74
Figure 8106
4.
Click Add Schema. Figure 8107 shows the resulting page with the package hierarchy expanded.
Figure 8107
In the directory that you specified in the JAXB Class Directory field, you should see the following files:
Approve.java and Approve.class ApproveImpl.java and ApproveImpl.class ApproveType.java and ApproveType.class ApproveTypeImpl.java and ApproveTypeImpl.class jaxb.properties
8-75
8.10.5 Import the JAXB Classes into the Oracle Business Rules Data Model
After generating the JAXB classes, you can import them into the Oracle Business Rules data model. These JAXB classes become XML facts that you can use when you create your rules.
1. 2.
If you are not on the XML Schema Selector page, click the Definitions tab, then click XML Fact on the left side, then click Create on the XMLFact Summary page. Select the check box next to com.
XML Schema Selector Page, with "com" Selected
Figure 8108
3.
Click Import. You should see a confirmation page. The classes that have been imported are shown in bold. Also on the left side, note that there are now three XML Facts.
8-76
Figure 8109
In the Definitions tab, click Variable on the left side. In the Variable Summary page, click Create. On the Variable page:
Name: enter AUTOMATED_ORDER_LIMIT. Alias: enter AUTOMATED_ORDER_LIMIT. Final: select this option. Type: select float. Expression: enter 1000.00.
8-77
Figure 8110
Variable Page
4.
Click OK. Rule Author shows the Variable Summary page. Note that the variable name is prefixed with DM (for "data model").
Variable Summary Page
Figure 8111
Click the Rulesets tab. This displays the RuleSet Summary page. On the RuleSet Summary page, click Create. This displays the Ruleset page. On the Ruleset page, enter ApproveOrderRequired as the Name. You can also enter a description if you like.
8-78
Figure 8112
Ruleset Page
4.
Click OK. You should see the RuleSet Summary page showing the new ruleset. The new ruleset also appears on the left side.
RuleSet Summary Page
Figure 8113
overLimit
platinumMember
Click the Rulesets tab. Click the ApproveOrderRequired ruleset on the left side. This displays the Ruleset page.
8-79
Figure 8114
3. 4. 5. 6.
In the Rules section, click Create. This displays the Rule page. On the Rule page, enter belowLimit for the Name. Keep the default value for Priority. In the "If" section, click New Pattern. This pops up the Pattern Definition window. In the Pattern Definition window, in the Choose Pattern section:
Do not choose anything from the first field (that is, leave it empty). Enter approve in the second field. Select ApproveType from the dropdown.
7.
In the Define Test for Pattern section, click Create. Then fill in the section as follows:
Operand: select approve.price. Operator: select < (less than). Operand (choose Value or Field): select AUTOMATED_ORDER_LIMIT under Field. Select Fixed in the dropdown.
8-80
Figure 8115
8. 9.
Click Apply in the Pattern Definition window. You should see a confirmation message at the top of the Pattern Definition window. Click OK to return to the Rule page, which now looks like this:
Rule Page for the "belowLimit" Rule
Figure 8116
10. Click Apply on the Rule page. You should see a confirmation message at the top of
Action window.
12. In the Add Action window:
Action Type: select Assign. Name: select approve.approvalRequired. Expression: enter false.
8-81
Figure 8117
13. Click Apply. 14. Click OK to return to the Rule page, which now looks like this: Figure 8118 Rule Page for the "belowLimit" Rule
15. Click Apply. 16. Save your work. Click the Save Dictionary link at the top of the page, then click
8-82
2.
Click the ApproveOrderRequired ruleset on the left side. This displays the Ruleset page. The "belowLimit" rule is already created.
Ruleset Page for the "ApproveOrderRequired" Ruleset
Figure 8119
3. 4. 5. 6.
In the Rules section, click Create. This displays the Rule page. On the Rule page, enter overLimit for the Name. Keep the default value for Priority. In the "If" section, click New Pattern. This pops up the Pattern Definition window. In the Pattern Definition window, in the Choose Pattern section:
Do not choose anything from the first field (that is, leave it empty). Enter approve in the second field. Select ApproveType from the dropdown.
7.
In the Define Test for Pattern section, click Create. Then fill in the section as follows.
Operand: select approve.price. Operator: select >= (greater than or equal to). Operand (choose Value or Field): select AUTOMATED_ORDER_LIMIT under Field. Select Fixed in the dropdown.
8-83
Figure 8120
8.
Click Create again to define the second test. Fill in the section as follows.
Operand: select approve.status. Operator: select != (not equal to). Operand (choose Value or Field): enter "Platinum" (include the double-quote characters) under Value. Select Fixed in the dropdown.
9.
Click Apply in the Pattern Definition window. You should see a confirmation message at the top of the Pattern Definition window.
10. Click OK to return to the Rule page. 11. The Rule page now looks like this:
8-84
Figure 8122
12. Click Apply on the Rule page. You should see a confirmation message at the top of
Action window.
14. In the Add Action window:
Action Type: select Assign. Name: select approve.approvalRequired. Expression: enter true.
Add Action for the "overLimit" Rule
Figure 8123
15. Click Apply. 16. Click OK to return to the Rule page, which now looks like this:
8-85
Figure 8124
17. Click Apply. 18. Save your work. Click the Save Dictionary link at the top of the page, then click
Click the Rulesets tab. Click the ApproveOrderRequired ruleset on the left side. This displays the Ruleset page. The "belowLimit" and "overLimit" rules are already created.
Ruleset Page for the "ApproveOrderRequired" Ruleset
Figure 8125
3.
In the Rules section, click Create. This displays the Rule page.
8-86
4. 5. 6.
On the Rule page, enter platinumMember for the Name. Keep the default value for Priority. In the "If" section, click New Pattern. This pops up the Pattern Definition window. In the Pattern Definition window, in the Choose Pattern section:
Do not choose anything from the first field (that is, leave it empty). Enter approve in the second field. Select ApproveType from the dropdown.
7.
In the Define Test for Pattern section, click Create. Then fill in the section as follows.
Operand: select approve.status. Operator: select == (equal to). Operand (choose Value or Field): enter "Platinum" (include the double-quote characters) under Value. Select Fixed in the dropdown.
8. 9.
Click Apply in the Pattern Definition window. You should see a confirmation message at the top of the Pattern Definition window. Click OK to return to the Rule page.
8-87
Figure 8127
11. Click Apply on the Rule page. You should see a confirmation message at the top of
Action window.
13. In the Add Action window:
Action Type: select Assign. Name: select approve.approvalRequired. Expression: enter false.
Add Action for the "platinumMember" Rule
Figure 8128
14. Click Apply. 15. Click OK to return to the Rule page, which now looks like this:
8-88
Figure 8129
16. Click Apply. 17. Save your work. Click the Save Dictionary link at the top of the page, then click
Copy the c:\rules\sample_repository file to the SOADEMO\SOAOrderBooking\bpel\rules\oracle directory. Copy the files from c:\rules\com\oracle\demos\orderbooking to the SOADEMO\SOAOrderBooking\bpel\rules\com\oracle\demos\orderbook ing directory.
8-89
In the Component Palette, select Process Activities from the dropdown. Drag the Decide icon from the Component Palette and drop it after the "CreditService" scope. This displays the Edit Decide dialog. In the Edit Decide dialog, enter RequiresManualApproval in the Name field.
8-90
4. 5.
For the Decision Service field, click the wand icon. This launches the Decision Service wizard. In Step 1, Select a Ruleset or Function:
Service Name: enter DecisionService (which is the default name). Namespace: enter http://www.globalcompany.com/ns/OrderBooking/DecisionService (which is the default). Invocation Pattern: select Execute Ruleset. Ruleset: click the flashlight icon, which displays the Rule Explorer. In the Rule Explorer, you should see sample_repository. Expand it, then expand OrderBookingRules (which is the name of the dictionary), and select ApproveOrderRequired (which is the name of the ruleset).
Rule Explorer
Figure 8131
Back in step 1 of the wizard, select Assert Fact and Watch Fact for Approve. Check here to assert all descendants from the top level element: do not select.
8-91
Figure 8132
Click Next.
7.
If the wizard complains about missing files, copy the files that it wants to the desired location. This screen is likely to appear if you are running JDeveloper and Oracle Application Server on separate machines and you copied the Oracle Business Rules repository from the Oracle Application Server machine to the JDeveloper machine.
Decision Service Wizard, Step 2, Copy XSD Files
Figure 8133
Click Next.
8. 9.
On the Finish page, click Finish. Back to the Edit Decide dialog:
Decision Service: set to DecisionService automatically. Operation: select Assert facts, execute rule set, retrieve results.
8-92
Figure 8134
Click OK.
10. Select File > Save to save your work.
the SOAOrderBooking\decisionservices directory the "DecisionServicePL" partner link the following activities in the "RequiresManualApproval" decide activity (expand "RequiresManualApproval" to see the activities): Assign activity: "BPEL_Var_To_Rule_Facts" Assign activity: "Facts_To_Rule_Service" Assign activity: "BPEL_Header" Invoke activity: "Invoke" Assign activity: "Rule_Service_To_Facts" Assign activity: "Facts_To_BPEL_Var"
If JDeveloper displays these activities in a somewhat random order, save and close the SOAOrderBooking.bpel file. Then reopen it.
the following variables in the "RequiresManualApproval" decide activity: com_oracle_demos_orderbooking_Approve_i com_oracle_demos_orderbooking_Approve_o dsIn dsOut
To see these variables, click the (x) icon on the left side of the "RequiresManualApproval" decide activity (Figure 8135). This displays the Variables dialog (Figure 8136).
8-93
Figure 8135 The Red Circle Highlights the Variable Icon for the "RequiresManualApproval" Decide Activity
8.11.2 Copy Order Total and Customer Status Information ("BPEL_Var_To_Rule_Facts" Assign Activity)
The default "BPEL_Var_To_Rule_Facts" assign activity does not contain any operations. You have to define the operations yourself. For the SOA Order Booking application, you define two copy operations:
Copy the order total price to the com_oracle_demos_orderbooking_ Approve_i variable. Copy it to the approve/price element of the variable. Copy the status of the customer (retrieved from findCustomerById) to the com_ oracle_demos_orderbooking_Approve_i variable. Copy it to the approve/status element of the variable. Double-click the "BPEL_Var_To_Rule_Facts" activity to display the Assign dialog. Click the Copy Operation tab. You will define two copy operations. For the first copy operation, select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.
1. 2. 3.
8-94
a. b.
On the To side, set Type to Expression. Click the XPath Expression Builder icon above the Expression box to display the Expression Builder dialog. You will use the Expression Builder to create the expression. In the Expression Builder dialog, in the BPEL Variables box, select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns4:PurchaseOrder > ns4:OrderInfo > ns4:OrderPrice. The Content Preview box should show bpws:getVariableData(inputVariable, payload, /client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:OrderInf o/ns4:OrderPrice). The ns4 prefix maps to the "http://www.globalcompany.com/ns/order" namespace. It may be different on your system. If you want, you can scroll to the top of your SOAOrderBooking.bpel file (in source view) to verify the prefix.
c.
d. e.
Click Insert Into Expression. The Expression box should show the function with the three parameters. In the Expression box, wrap the number() function around the entire bpws:getVariableData function. The value in the Expression box should look like this:
number(bpws:getVariableData('inputVariable','payload', '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ ns4:OrderInfo/ns4:OrderPrice'))
Figure 8137
8-95
f. g. h.
Click OK in the Expression Builder dialog. On the From side, set Type to Variable. Select Variables > Process > Scope - RequiresManualApproval > Variables > com_oracle_demos_orderbooking_Approve_i > ns13:approve > ns13:price.
Create Copy Operation Dialog
Figure 8138
i. 4.
Click OK in the Create Copy Operation dialog. This returns you to the Assign dialog.
Select Copy Operation from the Create dropdown again to create the second copy operation.
a. b.
On the To side, set Type to Expression. Click the XPath Expression Builder icon above the Expression box to display the Expression Builder dialog. You will use the Expression Builder to create the expression. In the Expression Builder dialog, in the BPEL Variables box, select Variables > Process > Variables > customerServiceResponse > parameters > ns8:findCustomerByIdResponse > ns8:return > ns8:status. The Content Preview box should show bpws:getVariableData(customerServiceResponse,parameters,/ns8:findCu stomerByIdResponse/ns8:return/ns8:status). The ns8 prefix maps to the "http://www.globalcompany.com/ns/customer" namespace. It may be different on your system. If you want, you can scroll to the top of your SOAOrderBooking.bpel file (in source view) to verify the prefix.
c.
d.
Click Insert Into Expression. The Expression box should show the function with the three parameters.
8-96
e.
In the Expression box, wrap the string() function around the entire bpws:getVariableData function. The value in the Expression box should look like this:
string(bpws:getVariableData('customerServiceResponse','parameters', '/ns8:findCustomerByIdResponse/ns8:return/ns8:status'))
Figure 8139
f. g. h.
Click OK in the Expression Builder dialog. On the From side, set Type to Variable. Select Variables > Process > Scope - RequiresManualApproval > Variables > com_oracle_demos_orderbooking_Approve_i > ns13:approve > ns13:status.
8-97
Figure 8140
i. 5. 6.
Click OK in the Assign dialog. Select File > Save to save your work.
8.11.3 Copy the ConversationId to the dsIn Variable ("BPEL_Header" Assign Activity)
The default "BPEL_Header" assign activity comes with seven copy operations. Add another copy operation to copy the conversation ID to the dsIn variable.
1. 2. 3.
Double-click the "BPEL_Header" activity to display the Assign dialog. Click the Copy Operation tab. Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.
a. b.
On the From side, set Type to Expression. Enter the following in the Expression box.
ora:getConversationId()
c. d.
On the To side, set Type to Variable. Select Variables > Process > Scope - RequiresManualApproval > Variables > dsIn > payload > ns12:assertExecuteWatchStateful > ns12:bpelInstance > ns14:conversationId.
8-98
Figure 8141
e. 4. 5.
Click OK in the Create Copy Operation dialog. This returns you to the Assign dialog.
Click OK in the Assign dialog. Select File > Save to save your work.
Scroll to the top of the page and double-click the SOAOrderBooking scope. You can double-click the "SOAOrderBooking" text that is sideways. This displays the Process dialog. In the Process dialog, click Create in the Variables tab. This displays the Create Variable dialog. In the Create Variable dialog:
2. 3.
Name: enter requiresApproval. Type: select Simple Type, and click the flashlight icon. This displays the Type Chooser dialog. In the Type Chooser, select boolean and click OK.
8-99
Figure 8142
4.
Click OK in the Create Variable dialog. The requiresApproval variable appears in the Process dialog.
Process Dialog Showing the "requiresApproval" Variable
Figure 8143
5. 6.
Click OK in the Process dialog. Select File > Save to save your work.
8.11.5 Copy the Result of the Decision Service to the requiresApproval Variable ("Facts_To_BPEL_Var" Assign Activity)
The default "Facts_To_BPEL_Var" assign activity does not come with any operations. Create a copy operation to copy the result returned by the "DecisionService" partner link to the requiresApproval process variable.
1. 2. 3.
Double-click the "Facts_To_BPEL_Var" assign activity to display the Assign dialog. Click the Copy Operation tab. Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.
4. 5.
On the From side, set Type to Variable. Select Variables > Process > Scope - RequiresManualApproval > Variables > dsOut > payload > ns12:assertExecuteWatchStatefulDecision > ns12:resultList > ns13:approve > ns13:approvalRequired. On the To side, set Type to Variable. Select Variables > Process > Variables > requiresApproval.
Create Copy Operation Dialog
6. 7.
Figure 8144
8. 9.
Click OK in the Create Copy Operation dialog. You should see the copy operation in the Assign dialog. Click OK.
Assign Dialog
Figure 8145
8-101
Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)
8.12 Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)
For orders that require manual approval, the "requiresApproval" switch passes control to a human task activity. This enables a manager to approve or reject the orders. The "requiresApproval" consists of a <case> branch only. It does not have an <otherwise> branch. For orders that do not require manual approval, this switch does not apply to them. The <case> branch contains a human task activity and another switch activity (Figure 8146).
Figure 8146 "requiresApproval" Switch Contains a Human Task and a Switch (Minimized View)
Figure 8147 shows the human task activity expanded. Figure 8148 shows the switch activity expanded.
Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)
Figure 8147
Figure 8148
8-103
Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)
In the Component Palette, select Process Activities from the dropdown. Drag the Switch icon from the Component Palette and drop it below the "RequiresManualApproval" decide activity. Double-click the new switch activity and set its name to requiresApproval in the Switch dialog. Click OK. Expand the switch activity. Delete the <otherwise> box. For this switch, you only need to handle the case where an order requires manual approval.
Double-click the title bar of the <case> box to display the Switch Case dialog. In the Switch Case dialog, click the XPath Expression Builder icon above the Expression box to display the Expression Builder dialog. In the Expression Builder dialog, select getVariableData in the Functions box. The Content Preview box should show bpws:getVariableData().
4.
Add the first parameter to the function: In the BPEL Variables box, select Variables > Process > Variables > requiresApproval. requiresApproval is a process variable that you defined in Section 8.11.4, "Create the "requiresApproval" Process Variable". The Content Preview box should show bpws:getVariableData(requiresApproval).
5. 6.
Click Insert Into Expression. The Expression box should show the function with the one parameter. Append =true to the expression in the Expression box so that the expression looks like this:
bpws:getVariableData('requiresApproval')='true'
7.
In the Expression box, wrap the string() function around the entire bpws:getVariableData function. The value in the Expression box should look like this:
string(bpws:getVariableData('requiresApproval')) = true
Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)
Figure 8149
8.
Click OK in the Expression Builder dialog. The Switch Case dialog now contains the expression:
Switch Case Dialog
Figure 8150
9.
8-105
Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)
In the Component Palette, select Process Activities from the dropdown. Drag the Human Task icon from the Component Palette and drop it in the Sequence area in the <case> box. This displays the Add a Human Task dialog. In the Add a Human Task dialog, click the Create Task Definition icon (the second icon for the Task Definition field). This displays a different Add a Human Task dialog. In the second Add a Human Task dialog, enter ApproveOrder for the Human Task Name. This sets the location to: SOADEMO\SOAOrderBooking\bpel\ApproveOrder\ApproveOrder.task.
Add a Human Task Dialog
4.
Figure 8152
Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)
5. 6. 7.
Click OK. JDeveloper closes the Add a Human Task dialog and displays the ApproveOrder.task page. In the ApproveOrder.task page, you can leave the Title empty. For Parameters:
a. b.
Click the green + icon, which displays the Add Task Parameter dialog. In the Add Task Parameter dialog, select Element and click the flashlight icon, which displays the Type Chooser dialog. In the Type Chooser dialog, select Type Explorer > Project Schema Files > OrderBookingPO.xsd > PurchaseOrder.
Type Chooser Dialog for ApproveOrder.task Parameter
Figure 8153
Click OK in the Type Chooser dialog. The Add Task Parameter dialog now looks like this:
Figure 8154 Add Task Parameter Dialog
c. 8.
8-107
Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)
a.
Click the green + icon. This displays the Add Participant Type dialog.
Add Participant Type Dialog
Figure 8155
b. c. d.
For Type, select Single Approver. For Label, enter Manager. Select By Name, and click the flashlight for Group Id(s) because you want to give the approve authority to a group. This displays the Identity Lookup dialog. In the Identity Lookup dialog, click Lookup. This should produce a list of group names in the Search Group box. Select Supervisor in the Search Group box and click Select. This moves the name to the Selected Group box.
e. f.
Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)
Figure 8156
g. 9.
Click OK in the Identity Lookup dialog. "Supervisor" now appears in the Add Participant Type dialog (see Figure 8155).
Click OK in the Add Participant Type dialog. The ApproveOrder.task page now looks like this:
Figure 8157
8-109
Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)
11. Close ApproveOrder.task (select File > Close). 12. Back on the SOAOrderBooking.bpel main page, double-click the "ApproveOrder_
1" human task activity. This displays the Human Task dialog.
13. For the Task Title field, enter Approve Order. 14. The Task Parameters column is filled in with "PurchaseOrder", but the BPEL
Variable column is blank. Click the flashlight icon in the BPEL Variable column.
15. In the Task Parameters dialog, select Variables > Process > Variables >
Set Up a Form to Process Orders That Require Manual Approval ("requiresApproval" Switch)
Figure 8159
Click OK in the Human Task dialog. JDeveloper creates the SOADEMO\SOAOrderBooking\bpel\ApproveOrder directory, and creates these files in it:
In the Application Navigator, right-click the ApproveOrder folder (located under SOAOrderBooking > Integration Content) and select Auto Generate Simple Task Form. JDeveloper displays the payload-body.jsp file in the editor. You can close it without making any changes to it.
2.
8.12.6 Accept the Default Settings for the Remaining Human Task Activities
Expand the "ApproveOrder_1" human task activity to see the activities contained in this scope (see Figure 8147). You can just accept the default settings for these activities.
8-111
The manager rejected the order. The manager approved the order. The order has expired.
set the status item to a string saying that the order has been rejected, and create a throw activity
Expand the switch. For <case Task outcome is REJECT>, delete the default "CopyPayloadFromTask" assign activity. There are now no activities for the REJECT case. In the Component Palette, select Process Activities from the dropdown. Drag the Assign activity icon from the Component Palette and drop it in the REJECT case. Double-click the new assign activity to display the Assign dialog. In the Assign dialog, click the Copy Operation tab. Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog. In the From side, set Type to Expression, and enter the following line in the Expression box:
string('Order has been rejected by the manager')
9.
In the To side, set Type to Variable, and select Variables > Process > Variables > OrderBookingFault > payload > client:SOAOrderBookingProcessFault > client:status.
Figure 8160
10. Click OK in the Create Copy Operation dialog. You should see the copy operation
Drag the Throw icon from the Component Palette and drop it below the previous assign activity. Double-click the new throw activity to display the Throw dialog.
8-113
3.
Name: enter Throw_1 (keep the default name). Namespace URI: enter http://www.globalcompany.com/ns/OrderBooking. You have to enter it manually. Local Part: enter OrderBookingFault. You have to enter it manually. Fault Variable: click the flashlight and select OrderBookingFault.
Throw Dialog for the REJECT Case
Figure 8162
4.
Figure 8164 shows the activities in the flow, and also the switch activity after the flow. The scope for Select Manufacturer includes a receive activity, which is not required for the scope for Rapid Service. This is because Select Manufacturer is invoked asynchronously. The receive activity is needed to receive the bid when Select Manufacturer returns it. Rapid Service is invoked synchronously; the invoke activity invokes the request and receives the response (that is, the bid value). The switch activity has two branches: the <case> branch handles the case where SelectManufacturer returned the lower bid, and the <otherwise> branch handles the case where Rapid Service returned the lower bid.
8-115
Figure 8164
create and deploy the SelectManufacturer and RapidService services, which were described in Chapter 7, "Creating the SelectManufacturer Project" and Chapter 6, "Creating the RapidService Project". create partner links to SelectManufacturer and RapidService.
In the Component Palette, select Services from the dropdown. Drag the Partner Link icon from the Component Palette and drop it in a Services swimlane. In the Create Partner Link dialog:
Name: enter SelectService. WSDL File: click the service explorer (flashlight) icon (the second icon from the left). This displays the Service Explorer dialog.
In the Service Explorer dialog, select Service Explorer > BPEL Services > soaDemoIntgServer > processes > default > SelectManufacturer. soaDemoIntgServer refers to your connection to the Integration Server where you deployed Select Manufacturer.
Figure 8165 Service Explorer Dialog for the "SelectService" Partner Link
Partner Link Type: select SelectService_PL (automatically filled in for you). Partner Role: select SelectServiceProvider. My Role: select SelectServiceRequester.
4. 5.
Click OK in the Create Partner Link dialog. Select File > Save to save your work.
Creating the SOAOrderBooking Project 8-117
Copy the following file from the soademo_101310_prod.zip file to the SOAOrderBooking\bpel directory.
RapidService.wsdl
The WSDL file is located in the SOAOrderBooking\bpel directory in the soademo_101310_prod.zip file.
2.
Select File > Open and open the RapidService.wsdl file. Click the Source tab at the bottom of the editor to view the lines in the file. The http://localhost:8888 reference in the file assumes that Oracle Application Server is running on the same machine as JDeveloper, and that Oracle Application Server is listening for requests on port 8888. If necessary, change localhost to the name of the machine running Oracle Application Server, and 8888 to the correct port used by your Oracle Application Server installation, for example: mypc.mydomain.com:8889.
d. 3. 4.
If you edited the file, save the file and close it.
Drag the Partner Link icon from the Component Palette and drop it in a partner link area. In the Create Partner Link dialog:
Name: enter RapidService. WSDL File: click the Service Explorer icon (second icon from the left) to display the Service Explorer dialog. In the Service Explorer dialog, expand Project WSDL Files and select RapidService.wsdl.
Service Explorer Dialog for the "RapidService" Partner Link
Figure 8167
5. 6.
Click OK in the Create Partner Link dialog. Select File > Save to save your work.
In the Component Palette, select Process Activities from the dropdown. Drag the Scope icon from the Component Palette and drop it below the "requiresApproval" switch activity. Double-click the new scope to display the Scope dialog. In the Scope dialog, in the General tab:
5. 6. 7.
Click the Variables tab. You need to create two variables for this scope. In the Variables tab, click Create to create the first variable. In the Create Variable dialog:
Name: enter selectManufacturerResponse. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > SelectService > SelectManufacturer > Message Types > RequestQuote_ processRequestQuoteResponse.
8-119
Figure 8169
In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/selectservice}RequestQuote_ processRequestQuoteResponse.
Create Variable Dialog for the "selectManufacturerResponse" Variable
Figure 8170
9.
10. In the Variables tab, click Create again to create the second variable. 11. In the Create Variable dialog:
Name: enter rapidManufacturerResponse. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > RapidService > RapidService.wsdl > Imported WSDL >
{http://www.globalcompany.com/ns/rapidservice}RequestQuotePor tType_POItemsQuoteResponse.
Figure 8172 Create Variable Dialog for the "rapidManufacturerResponse" Variable
13. Click OK in the Create Variable dialog. 14. The variables appear in the Variables tab of the Scope dialog.
8-121
Figure 8173
Expand the new "SelectSupplier" scope. Drag the Flow icon from the Component Palette and drop it into the new "SelectSupplier" scope. Double-click the new flow instance and in the Flow dialog, set the name to CallManufacturers.
Expand the "CallManufacturers" flow. The flow has two parallel areas where you can define activities.
Figure 8174
2.
Drag the Scope icon from the Component Palette and drop it into the left side of the flow. The left side of the flow handles requests to and responses from Select Manufacturer. Double-click the new scope instance. This displays the Scope dialog. In the Scope dialog, in the General tab:
3. 4.
5. 6. 7.
Click the Variables tab. You need to create a variable for this scope. In the Variables tab, click Create. In the Create Variable dialog:
Name: enter manufacturerRequest. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > SelectService > SelectManufacturer > Message Types > RequestQuote_ processRequestQuote.
8-123
Figure 8175
In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/selectservice}RequestQuote_ processRequestQuote.
Create Variable Dialog for the "manufacturerRequest" Variable
Figure 8176
9.
10. The manufacturerRequest variable appears in the Variables tab of the Scope
Figure 8177
Expand the "GetSelectMfrQuote" scope. Drag the Transform icon from the Component Palette and drop it in the "GetSelectMfrQuote" scope. Double-click the transform activity to display the Transform dialog. In the General tab, set the name to TransformSelectRequest. In the Transformation tab, set the Source Variable to inputVariable, and the Source Part to payload. Set the Target Variable to manufacturerRequest and the Target Part to parameters.
6. 7. 8. 9.
Set the Mapper File to SelectTransformation.xsl. This file does not exist yet; you will use the Data Mapper to generate it. Click the Create Mapping icon (second icon from the left). This displays the Data Mapper, which you will use to generate the SelectTransformation.xsl file. In the Data Mapper, on the Source (left) side, expand po:PurchaseOrder > po:OrderItems > po:Item. On the Target (right) side, expand tns:param0.
10. Drag po:ProductName to tns:itemId. 11. Drag po:Quantity to tns:quantity. The Data Mapper should look like the
following:
8-125
Figure 8178
12. In the Component Palette for the Data Mapper, select XSLT Constructs from the
dropdown.
13. Drag the for-each icon from the Component Palette and drop it on tns:param0 on
the target side. You want the for-each item to appear between tns:processRequestQuoteElement and tns:param0.
14. Drag po:Item to the for-each item on the target side. The Data Mapper should
15. Select File > Save to save SelectTransformation.xsl. This file is created in
Drag the Invoke icon from the Component Palette and drop it below the "TransformSelectRequest" transform activity. Do one of the following to display the Invoke dialog:
Drag one of the arrows on the side of the new invoke activity and drop it on the "SelectService" partner link. This associates the invoke activity with the partner link. Double-click the new invoke activity.
3. 4.
In the Invoke dialog, set the name of the invoke activity to InvokeSelectManufacturer. If the Partner Link field is not set to SelectService, click the flashlight. In the Partner Link Chooser, select SelectService and click OK.
Partner Link Chooser Dialog for the "InvokeSelectManufacturer" Invoke
5. 6.
For Operation, select processRequestQuote. This should be filled in automatically for you. For Input Variable, click the Browse Variable icon, which displays the Variable Chooser dialog. In the dialog, select Variables > Process > Scope - SelectSupplier > Scope - GetSelectMfrQuote > Variables > manufacturerRequest.
8-127
Figure 8181 Variable Chooser for the Input Variable for the "InvokeSelectManufacturer" Invoke Activity
Figure 8182
Drag the Receive icon from the Component Palette and drop it below the "InvokeSelectManufacturer" activity. Do one of the following to display the Receive dialog:
Drag one of the arrows on the side of the new receive activity and drop it on the "SelectService" partner link. This associates the receive activity with the partner link. Double-click the new receive activity.
3. 4.
For Name, set it to ReceiveSelectManufacturer. Partner Link should be set to SelectService. If not, click the flashlight icon, which displays the Partner Link Chooser. Select SelectService and click OK.
Partner Link Chooser Dialog for the "ReceiveSelectManufacturer" Receive
5. 6.
For Operation, set it to processRequestQuoteResponse. This should be filled in automatically for you. For Variable, click the Browse Variable icon, which displays the Variable Chooser. Select Variables > Process > Scope - SelectSupplier > Variables > selectManufacturerResponse.
8-129
For the Create Instance option, do not select it. The Receive dialog looks like Figure 8185. Click OK.
Receive Dialog
Figure 8185
9.
Drag the Scope icon from the Component Palette and drop it in the right side of the flow. You will define activities in this scope to handle requests to and responses from Rapid Manufacturer. Double-click the new scope activity to display the Scope dialog. In the General tab, set the name of the scope to CallRapidManufacturer. Do not select Variable Access Serializable.
2. 3.
4. 5. 6.
In the Variables tab, click Create, which displays the Create Variable dialog. In the Create Variable dialog, enter manufacturerRequest as the variable name. Select Message Type and click the flashlight, which displays the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > RapidService > RapidService.wsdl > Imported WSDL > RequestQuoteSoapHttpPort > Message Types > RequestQuotePortType_ POItemsQuote.
Type Chooser Dialog for the "CallRapidManufacturer" Scope
Figure 8186
In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/rapidservice}RequestQuotePor tType_POItemsQuote.
8-131
Figure 8187
8. 9.
Click OK in the Create Variable dialog. The manufacturerRequest variable appears in the Variables tab of the Scope dialog.
Scope Dialog for the "CallRapidManufacturer" Scope
Figure 8188
Expand the "CallRapidManufacturer" scope. Drag the Transform icon from the Component Palette and drop it in the "CallRapidManufacturer" scope. Double-click the transform activity to display the Transform dialog. In the General tab, set the name to TransformRapidRequest. In the Transformation tab, set the Source Variable to inputVariable, and the Source Part to payload.
Set the Target Variable to manufacturerRequest and the Target Part to parameters.
6. 7. 8. 9.
Set the Mapper File to RapidTransformation.xsl. This file does not exist yet; you will use the Data Mapper to generate it. Click the Create Mapping icon (second icon from the left). This displays the Data Mapper, which you will use to generate the RapidTransformation.xsl file. In the Data Mapper, on the Source (left) side, expand po:PurchaseOrder > po:OrderItems > po:Item. On the Target (right) side, expand tns:items.
10. Drag po:ProductName to tns:itemId. 11. Drag po:Quantity to tns:quantity. The Data Mapper should look like the
following:
Figure 8189 Data Mapper for Rapid Manufacturer (Not Complete Yet)
12. In the Component Palette for the Data Mapper, select XSLT Constructs from the
dropdown.
13. Drag the for-each icon from the Component Palette and drop it on tns:items on the
target side. You want the for-each item to appear between tns:POItemsQuote and tns:items.
14. Drag po:Item to the for-each item on the target side. The Data Mapper should
8-133
Figure 8190
15. Select File > Save to save RapidTransformation.xsl. This file is created in the
SOAOrderBooking\bpel directory.
16. Select File > Close to close the Data Mapper for RapidTransformation.xsl. 17. Select File > Save to save SOAOrderBooking.bpel.
Drag the Invoke icon from the Component Palette and drop it below the "TransformRapidRequest" transform activity. Do one of the following to display the Invoke dialog:
Drag one of the arrows on the side of the new invoke activity and drop it on the "RapidService" partner link. This associates the invoke activity with the partner link. Double-click the new invoke activity.
3. 4.
In the Invoke dialog, set the name of the invoke activity to InvokeRapidManufacturer. The Partner Link field should be set to RapidService. If not, click the flashlight and in the Partner Link Chooser, select RapidService and click OK.
Figure 8191
5. 6.
For Operation, select POItemsQuote. This should be filled in automatically for you. For Input Variable, click the Browse Variable icon, which displays the Variable Chooser dialog. In the dialog, select Variables > Process > Scope - SelectSupplier > Scope - CallRapidManufacturer > Variables > manufacturerRequest.
Figure 8192 Variable Chooser Dialog for the Input Variable for the "InvokeRapidManufacturer" Activity
8-135
7.
For Output Variable, click the Browse Variable icon, which displays the Variable Chooser dialog. In the dialog, select Variables > Process > Scope - SelectSupplier > Variables > rapidManufacturerResponse.
Figure 8193 Variable Chooser Dialog for the Output Variable for the "InvokeRapidManufacturer" Activity
Figure 8194
Minimize the flow activity in the "SelectSupplier" scope. (But do not minimize the scope.) The page should look like this:
Minimize Only the Flow Activity
Figure 8195
2. 3. 4.
Drag the Switch icon from the Component Palette and drop it below the "CallManufacturers" flow activity, but still within the "SelectSupplier" scope. Double-click the switch to display the Switch dialog. In the Switch dialog, set the name to SelectByPrice and click OK.
Expand the switch activity. Double-click the titlebar of the <case> box to display the Switch Case dialog. The <case> branch handles the case where Select Manufacturer returns a lower price than Rapid Service. In the Expression area, enter the following line:
number(bpws:getVariableData('selectManufacturerResponse','parameters', '/ns15:processRequestQuoteResponseElement/ns15:return/ns15:supplierPrice')) < number(bpws:getVariableData('rapidManufacturerResponse','parameters', '/ns16:POItemsQuoteResponse/ns30:return/ns30:supplierPrice'))
You may need to replace the prefixes for the namespaces, as follows:
ns15 is the prefix for http://www.globalcompany.com/ns/selectservice. ns16 is the prefix for http://www.globalcompany.com/ns/rapidservice.
Creating the SOAOrderBooking Project 8-137
You can also use the Expression Builder to create the condition:
a. b.
In the Switch Case dialog, click the XPath Expression Builder icon above the Expression box. In the Expression Builder dialog, select Variables > Process > Scope SelectSupplier > Variables > selectManufacturerResponse > parameters > ns15:processRequestQuoteResponseElement > ns15:return > ns15:supplierPrice. The Content Preview box in the dialog shows the bpws:getVariableData function with parameters to get the supplierPrice data.
c.
Click Insert Into Expression. The Expression Builder dialog should now look like this:
Figure 8196
d.
In the Expression Builder dialog, in the Expression box, type a < (less than) character. Figure 8197 shows the Expression box in the Expression Builder dialog.
Figure 8197
e.
In the Expression Builder dialog, select Variables > Process > Scope SelectSupplier > Variables > rapidManufacturerResponse > parameters > ns16:POItemsQuoteResponse > ns16:return > ns16:supplierPrice. Click Insert Into Expression. The Expression Builder dialog should now look like this:
f.
Figure 8198
g.
Wrap each bpws:getVariableData function with the number function, so that the expression looks like this:
number(bpws:getVariableData(....)) < number(bpws:getVariableData(....))
You have to manually type in number( before the bpws:getVariableData function and the closing parenthesis ) after the function. The final expression should look like this:
8-139
Figure 8199
h.
Figure 8200
4.
Drag the Assign activity icon from the Component Palette and drop it in the <case> box. Double-click the new assign activity to display the Assign dialog. In the Assign dialog, click the General tab, and set the Name to AssignSelectManufacturer. Still in the Assign dialog, click the Copy Operation tab. You will create two copy operations. Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.
In the From side, set Type to Variable, and select Variables > Process > Scope - SelectSupplier > Variables > selectManufacturerResponse > parameters > ns15:processRequestQuoteResponseElement > ns15:return > ns15:supplierPrice.
In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:SupplierInfo > ns1:SupplierPrice.
Figure 8201 Create Copy Operation Dialog for the "AssignSelectManufacturer" Activity, First Copy Operation
Select Copy Operation from the Create dropdown again to create the second copy operation. This displays the Create Copy Operation dialog.
In the From side, set Type to Variable, and select Variables > Process > Scope - SelectSupplier > Variables > selectManufacturerResponse > parameters > ns15:processRequestQuoteResponseElement > ns15:return > ns15:supplierName. In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:SupplierInfo > ns1:SupplierName.
8-141
Figure 8202 Create Copy Operation Dialog for the "AssignSelectManufacturer" Activity, Second Copy Operation
You should see two copy operations in the Assign dialog. Click OK.
Assign Dialog for the "AssignSelectManufacturer" Activity
Figure 8203
Drag the Assign activity icon from the Component Palette and drop it in the <otherwise> box. Double-click the new assign activity to display the Assign dialog.
3. 4. 5.
In the Assign dialog, click the General tab, and set the Name to AssignRapidManufacturer. Still in the Assign dialog, click the Copy Operation tab. You will create two copy operations. Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.
In the From side, set Type to Variable, and select Variables > Process > Scope - SelectSupplier > Variables > rapidManufacturerResponse > parameters > ns16:POItemsQuoteResponse > ns16:return > ns16:supplierPrice. In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:SupplierInfo > ns1:SupplierPrice.
Figure 8204 Create Copy Operation Dialog for the "AssignRapidManufacturer" Activity, First Copy Operation
Select Copy Operation from the Create dropdown again to create the second copy operation. This displays the Create Copy Operation dialog.
In the From side, set Type to Variable, and select Variables > Process > Scope - SelectSupplier > Variables > rapidManufacturerResponse > parameters > ns16:POItemsQuoteResponse > ns16:return > ns16:supplierName. In the To side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:SupplierInfo > ns1:SupplierName.
8-143
Figure 8205 Create Copy Operation Dialog for the "AssignRapidManufacturer" Activity, Second Copy Operation
You should see two copy operations in the Assign dialog. Click OK.
Assign Dialog for the "AssignRapidManufacturer" Activity
Figure 8206
8.
In the Component Palette, select Services from the dropdown. Drag the Partner Link icon from the Component Palette and drop it in a Services swimlane. This displays the Create Partner Link dialog. For Name, enter OrderFulfillment. For WSDL File, click the Service Explorer icon (second icon from the left) to display the Service Explorer dialog. In the Service Explorer dialog, select Service Explorer > Registered ESB Services > soademoIntegServer > Fulfillment > OrderFulfillment. soademoIntegServer refers to the name of the Integration Server connection.
8-145
Figure 8208
Back in the Create Partner Link dialog, if you get a java.net.UnknownHostException error:
Check that the proxy settings are set correctly. To view the proxy settings in JDeveloper, select Tools > Preferences. In the Preferences dialog, select Web Browser and Proxy on the left side. If the proxy settings are correct, replace the IP address in the URL with the hostname. For example: http://pc1.mydomain.com:8888/esb/wsil/Fulfillment/OrderFulfillment?ws dl Press the Tab key after you have entered the hostname.
6. 7. 8.
For Partner Link Type, select execute_pptLT. This should be filled in for you automatically. For Partner Role, select execute_pptProvider. For My Role, leave blank. The Create Partner Link dialog should look like this:
Figure 8209
9.
In the Component Palette, select Process Activities from the dropdown. Drag the Scope icon from the Component Palette and drop it below the "SelectSupplier" scope. Double-click the new scope to display the Scope dialog. In the General tab:
5. 6. 7.
Click the Variables tab. You need to create one variable for this scope. In the Variables tab, click Create. In the Create Variable dialog:
Name: enter orderFulfillmentRequest. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > OrderFulfillment > Imported WSDL > Fulfillment_OrderFulfillment.wsdl > Message Types > PurchaseOrder_request.
8-147
Figure 8210
In the Create Variable dialog, the Message Type is set to {http://www.globalcompany.com/ns/Fulfillment}PurchaseOrder_ request.
Create Variable Dialog for the "PostFulfillmentReq" Scope
Figure 8211
9.
Figure 8212
Expand the "PostFulfillmentReq" scope. Drag the Assign activity icon from the Component Palette and drop it in the "PostFulfillmentReq" scope. Double-click the new assign activity to display the Assign dialog. In the Assign dialog, click the General tab, and set the Name to initializeRequest. Still in the Assign dialog, click the Copy Operation tab. You will create a copy operation. Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.
In the From side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder. In the To side, set Type to Variable, and select Variables > Process > Scope PostFulfillmentReq > Variables > orderFulfillmentRequest > PurchaseOrder > ns1:PurchaseOrder.
8-149
Figure 8213
You should see the copy operation in the Assign dialog. Click OK.
Assign Dialog for the "initializeRequest" Activity
Figure 8214
***********************************************************************************************
Drag the Invoke icon from the Component Palette and drop it below the "initializeRequest" assign activity. Do one of the following to display the Invoke dialog:
Drag one of the arrows on the side of the new invoke activity and drop it on the "OrderFulfillment" partner link. This associates the invoke activity with the partner link. Double-click the new invoke activity.
3.
Name: enter PostFulfillmentReq. Partner Link: should be set to OrderFulfillment. If not, click the flashlight and select OrderFulfillment from the Partner Link Chooser.
Partner Link Chooser Dialog for the "PostFulfillmentReq" Invoke Activity
Figure 8215
Operation: select execute (should be filled in for you automatically). Input Variable: click the Browse Variables icon (the second icon from the left) and select Variables > Process > Scope - PostFulfillmentReq > Variables > orderFulfillmentRequest.
8-151
Figure 8216 Variable Chooser Dialog for the Input Variable for the "PostFulfillmentReq" Invoke Activity
Click OK in the Variable Chooser. The Invoke dialog should look like this:
Figure 8217 Invoke Dialog for the "PostFulfillmentReq" Invoke Activity
4. 5.
Click OK in the Invoke dialog. Select File > Save to save your work.
Click the "Add CatchAll Branch" icon on the side of the "PostFulfillmentReq" scope.
Figure 8218
2. 3. 4.
Expand the catch-all branch. Drag the Empty icon from the Component Palette and drop it in the catchall branch. The catch just catches the exceptions without processing them. Select File > Save to save your work.
8-153
Figure 8220
In the Component Palette, select Services from the dropdown. Drag the Database Adapter icon from the Component Palette and drop it in a Services swimlane. This starts the Adapter Configuration Wizard. Click Next to start. In Step 1, Service Name, set the Service Name to OrderStatus. Leave Description blank.
Adapter Configuration Wizard: Step 1, Service Name
3.
Figure 8221
Click Next.
4.
In Step 2, Service Connection, for Connection, select the name of the database connection. The JNDI Name should be set automatically to eis/DB/soademo.
Figure 8222
Click Next.
5.
In Step 3, Operation Type, select Perform an Operation on a Table and select Update Only.
Adapter Configuration WIzard: Step 3, Operation Type
Figure 8223
Click Next.
6. 7.
In Select Table, click Import Tables. This displays the Import Tables dialog. In the Import Tables dialog:
Click Query.
8-155
Select the ORDERS table on the left side and click the right arrow to move it to the Selected box.
Figure 8224 Adapter Configuration WIzard: Import Tables
Figure 8225
Click Finish to accept the defaults for the remaining screens. The wizard creates the following files:
SOAOrderBooking\bpel\OrderStatus.wsdl SOAOrderBooking\bpel\OrderStatus_table.xsd
9.
Oracle JDeveloper now displays the Partner Link dialog with some fields already filled in for you: Name: OrderStatus WSDL File: SOAOrderBooking/bpel/OrderStatus.wsdl Partner Link Type: OrderStatus_plt Partner Role: OrderStatus_role
Figure 8226
Click OK.
10. Select File > Save to save your work.
In the Component Palette, select Process Activities from the dropdown. Drag the Scope icon from the Component Palette and drop it below the "PostFulfillmentReq" scope. Double-click the new scope to display the Scope dialog. In the General tab:
5. 6. 7.
Click the Variables tab. You need to create one variable for this scope. In the Variables tab, click Create. In the Create Variable dialog:
Name: enter orderStatusRequest. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > OrderStatus > OrderStatus.wsdl > Message Types > OrdersCollection_msg.
8-157
Figure 8227 Type Chooser Dialog for the "orderStatusRequest" Variable in the "SetFinalOrderStatus" Scope
In the Create Variable dialog, the Message Type is set to {http://xmlns.oracle.com/pcbpel/adapter/db/OrderStatus/}Order sCollection_msg.
Figure 8228 Create Variable Dialog for the "orderStatusRequest" Variable in the "SetFinalOrderStatus" Scope
9.
10. The orderStatusRequest variable appears in the Variables tab of the Scope
Figure 8229
Expand the "SetFinalOrderStatus" scope. Drag the Assign activity icon from the Component Palette and drop it in the "SetFinalOrderStatus" scope. Double-click the new assign activity to display the Assign dialog. In the Assign dialog, click the General tab, and set the Name to AssignOrderStatus. Still in the Assign dialog, click the Copy Operation tab. You will create two copy operations. Create the first copy operation: Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.
In the From side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:ID. In the To side, set Type to Variable, and select Variables > Process > Scope SetFinalOrderStatus > Variables > orderStatusRequest > OrdersCollection > ns19:OrdersCollection > ns19:Orders > ns19:ordid.
8-159
Figure 8230 Create Copy Operation Dialog for the "AssignOrderStatus" Activity, First Copy Operation
Create the second copy operation: Select Copy Operation from the Create dropdown again. This displays the Create Copy Operation dialog.
In the From side, set Type to Expression, and enter the following line in the Expression box: string('completed')
In the To side, set Type to Variable, and select Variables > Process > Scope SetFinalOrderStatus > Variables > orderStatusRequest > OrdersCollection > ns19:OrdersCollection > ns19:Orders > ns19:status.
Figure 8231 Create Copy Operation Dialog for the "AssignOrderStatus" Activity, Second Copy Operation
You should see the copy operations in the Assign dialog. Click OK.
Assign Dialog for the "AssignOrderStatus" Activity
Figure 8232
8.16.4 Update the Order Status in the Database ("UpdateOrderStatus" Invoke Activity)
Create the "UpdateOrderStatus" invoke activity to update the order status in the ORDERS table in the database.
1. 2.
Drag the Invoke icon from the Component Palette and drop it below the "AssignOrderStatus" assign activity. Do one of the following to display the Invoke dialog:
Creating the SOAOrderBooking Project 8-161
Drag one of the arrows on the side of the new invoke activity and drop it on the "OrderStatus" database adapter. This associates the invoke activity with the database adapter. Double-click the new invoke activity.
3.
Name: enter UpdateOrderStatus. Partner Link: should be set to OrderStatus. If not, click the flashlight and select OrderStatus from the Partner Link Chooser.
Partner Link Chooser Dialog for the "UpdateOrderStatus" Invoke Activity
Figure 8233
Operation: select update. Input Variable: click the Browse Variables icon (the second icon from the left) and select Variables > Process > Scope - SetFinalOrderStatus > Variables > orderStatusRequest.
Figure 8234 Variable Chooser Dialog for the Input Variable in the "UpdateOrderStatus" Invoke Activity
Click OK in the Variable Chooser. The Invoke dialog should look like this:
Figure 8235 Invoke Dialog for the "UpdateOrderStatus" Invoke Activity
4. 5.
Click OK in the Invoke dialog. Select File > Save to save your work.
8-163
Drag the Email icon from the Component Palette and drop it below the "SetFinalOrderStatus" scope. This displays the Edit Email dialog. In the Edit Email dialog, enter any information you want for the email fields. Figure 8237 shows an example.
Edit Email Dialog
Figure 8237
For most of the fields, you can click the XPath Expression Builder icon to display the Expression Builder. This enables you to customize the data for the field.
8-164 Oracle SOA Suite Tutorial
In the To field, click the XPath Expression Builder icon (the icon on the right). In the Expression Builder dialog, select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns4:PurchaseOrder > ns4:UserContact > ns4:EmailAddress. Click Insert Into Expression. The dialog should look like this:
Expression Builder Dialog Showing the EmailAddress Field
c.
Figure 8238
d.
Click OK.
Example 2: Including the customer name, order ID, and order status in the Body of the email. The text that you want to enter looks like this:
Dear firstName This is to inform you that your order number, orderID, has been orderStatus If you have a question about your order, please contact customer service or send an email to [email protected] Thank you for doing business with Global Company. We appreciate your business! Global Company Customer Service
firstName, orderID, and orderStatus are placeholders for data that are to be retrieved dynamically.
a. b.
Click the XPath Expression Builder icon for Body. You will use the concat function to concatenate the pieces of the body text.
8-165
Place the insertion point before the last closing parenthesis. Add the variable for first name: select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns4:PurchaseOrder > ns4:ShipTo > ns4:Name > ns4:First. Click Insert Into Expression. The expression now looks like this:
concat(string('Dear '), bpws:getVariableData('inputVariable','payload', '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ShipTo/ ns4:Name/ns4:First'))
e.
f.
Add the next part of the message, up to order ID: place the insertion point before the last closing parenthesis, and type in the next part of the message, shown in bold:
concat(string('Dear '), bpws:getVariableData('inputVariable','payload', '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ShipTo/ ns4:Name/ns4:First'), string(This is to inform you that your order number ), )
You cannot insert line breaks in the Expression box but you can insert line breaks in the Edit Email dialog.
g. h.
Place the insertion point before the last closing parenthesis. Add the variable for the order ID: select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns4:PurchaseOrder > ns4:ID. Click Insert Into Expression. The expression now looks like this:
concat(string('Dear '), bpws:getVariableData('inputVariable','payload', '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ShipTo/ ns4:Name/ns4:First'), string('This is to inform you that your order number '), bpws:getVariableData('inputVariable','payload', '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ID'))
i.
j.
Add the string "has been " to the message. The new part is shown in bold.
concat(string('Dear '), bpws:getVariableData('inputVariable','payload', '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ShipTo/ ns4:Name/ns4:First'), string('This is to inform you that your order number '), bpws:getVariableData('inputVariable','payload', '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ID') , string(has been ), )
k. l.
Place the insertion point before the last closing parenthesis. Add the variable for the order status: select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns4:PurchaseOrder > ns4:OrderInfo > ns4:OrderStatus.
m. Click Insert Into Expression. The expression now looks like this: concat(string('Dear '), bpws:getVariableData('inputVariable','payload', '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ShipTo/ ns4:Name/ns4:First'), string('This is to inform you that your order number '), bpws:getVariableData('inputVariable','payload', '/client:SOAOrderBookingProcessRequest/ns4:PurchaseOrder/ns4:ID')
o.
Click OK in the Expression Builder. The Edit Email dialog now looks like the following. Line breaks have been added to the body text to make it easier to read.
Edit Email Dialog
Figure 8239
3. 4.
Click OK in the Edit Email dialog. Select File > Save to save your work.
If you expand the "Email_1" activity, you can see that it contains two activities: an assign activity and an invoke activity. You do not have to edit these activities. The assign activity, "EmailParamsAssign", contains the information that you provided in the Edit Email dialog. The invoke activity, "InvokeNotificationService", calls on the notification service to send the emails.
8-167
Drag the Invoke icon from the Component Palette and drop it below the "NotifyCustomer" (which is the "Email_1" scope) scope. Do one of the following to display the Invoke dialog:
Drag one of the arrows on the side of the new invoke activity and drop it on the "client" partner link. This associates the invoke activity with the partner link. Double-click the new invoke activity.
3.
Name: enter callbackClient. Partner Link: should be set to client. If not, click the flashlight and select client from the Partner Link Chooser.
Figure 8241
Operation: select onResult (this should be filled in automatically for you). Input Variable: click the Browse Variables icon (the second icon from the left) and select outputVariable.
Figure 8242 Variable Chooser Dialog for the Input Variable in the "callbackClient" Invoke Activity
Click OK in the Variable Chooser. The Invoke dialog should look like this:
8-169
Figure 8243
4.
Double-click the "callbackClient" invoke activity. This displays the Invoke dialog. Click the Sensors tab in the Invoke dialog. Click Create to create a new sensor. This displays the Create Activity Sensor dialog. In the Create Activity Sensor dialog, set the Name to InstanceCompleted. Set the Evaluation Time to Completion. This specifies when the sensor fires. Completion signifies that the sensor fires after this activity has run. In the Activity Variable Sensors section, click Create to display the Create Activity Variable Sensor dialog.
Create Activity Variable Sensor Dialog
Figure 8244
7.
In the Create Activity Variable Sensor dialog, click the pencil icon for Variable XPath. This displays the Variable XPath Builder dialog.
Figure 8245
8. 9.
Select Variables > Process > Variables > inputVariable. Click OK in the Variable XPath Builder dialog. The Create Activity Variable Sensor dialog should be filled in with these values for you (see Figure 8244): Variable XPath: $inputVariable Output Namespace: http://www.globalcompany.com/ns/OrderBooking Output Datatype: SOAOrderBookingRequestMessage
10. Click OK in the Create Activity Variable Sensor dialog. This takes you back to the
8-171
Figure 8246
11. In the Create Activity Sensor dialog, click the Add icon in the Sensor Actions
section. This displays the Sensor Action Chooser dialog. It shows an existing sensor called InstanceStart, which you created in Section 8.6.2, "Create a Sensor for the Receive Activity".
Figure 8247 Sensor Action Chooser Dialog
12. In the Sensor Action Chooser dialog, select Sensor Actions and select Sensor
Action from the wand icon. This displays the Create Sensor Action dialog.
13. In the Create Sensor Action dialog:
Name: enter InstanceCompleted. Publish Type: select JMS Topic. JMS Connection Factory: enter jms/TopicConnectionFactory. Publish Target: enter jms/demoTopic.
Figure 8248
14. Click OK in the Create Sensor Action dialog. The Sensor Action Chooser dialog
15. Click OK in the Sensor Action Chooser. This takes you back to the Create Activity
8-173
Figure 8250
In the Invoke dialog, the Sensors tab now looks like this:
Figure 8251 Invoke Dialog, Sensors Tab
17. Click OK in the Invoke dialog. 18. Select File > Save to save your work.
Click the triangular icon with an exclamation point at the "SOAOrderBooking" scope to add a catch branch to the project. Adding it at this level enables all activities in the project to use this catch.
8-175
Figure 8253
2.
Scroll to the right to see the new catch branch, and expand it. The new branch does not have any activity in it.
New Catch Branch
Figure 8254
3. 4.
Double-click the catch icon to display the Catch dialog. In the Catch dialog;
Namespace URI: enter http://www.globalcompany.com/ns/OrderBooking. Local Part: enter OrderBookingFault. Fault Variable: enter OrderBookingFault.
Figure 8255
Catch Dialog
5.
Expand the catch area, if you have not already done so. Drag the Sequence icon from the Component Palette and drop it in the catch area.
Drag the Scope icon from the Component Palette and drop it in the catch area. Double-click the new scope to display the Scope dialog. In the Scope dialog, in the General tab:
4. 5. 6.
Click the Variables tab. You need to create a variable for this scope. In the Variables tab, click Create. In the Create Variable dialog:
Name: enter orderStatusRequest. Select Message Type and click the flashlight icon to display the Type Chooser. In the Type Chooser, select Type Explorer > Message Types > Partner Links > OrderStatus > OrderStatus.wsdl > Message Types > OrdersColllection_msg.
8-177
Figure 8256
In the Create Variable dialog, the Message Type is set to {http://xmlns.oracle.com/pcbpel/adapter/db/OrderStatus/}Order sCollection_msg.
Create Variable Dialog for orderStatusRequest Variable
Figure 8257
8. 9.
Click OK in the Create Variable dialog. The orderStatusRequest variable appears in the Variables tab of the Scope dialog.
Figure 8258
Expand the "SetOrderStatus" scope. Drag the Assign activity icon from the Component Palette and drop it in the "SetOrderStatus" scope. Double-click the new assign activity to display the Assign dialog. In the Assign dialog, click the General tab, and set the Name to AssignOrderStatus. Still in the Assign dialog, click the Copy Operation tab. You will create three copy operations. Create the first copy operation: Select Copy Operation from the Create dropdown. This displays the Create Copy Operation dialog.
In the From side, set Type to Variable, and select Variables > Process > Variables > inputVariable > payload > client:SOAOrderBookingProcessRequest > ns1:PurchaseOrder > ns1:ID. In the To side, set Type to Variable, and select Variables > Process > Scope SetOrderStatus > Variables > orderStatusRequest > OrdersCollection > ns19:OrdersCollection > ns19:Orders >ns19:ordid.
8-179
Figure 8259 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, First Copy Operation
Create the second copy operation: Select Copy Operation from the Create dropdown again. This displays the Create Copy Operation dialog.
In the From side, set Type to Expression, and enter the following line in the Expression box:
string('canceled')
In the To side, set Type to Variable, and select Variables > Process > Scope SetOrderStatus > Variables > orderStatusRequest > OrdersCollection > ns19:OrdersCollection > ns19:Orders >ns19:status.
Figure 8260 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Second Copy Operation
Create the third copy operation: Select Copy Operation from the Create dropdown again. This displays the Create Copy Operation dialog. In the From side, set Type to Variable, and select Variables > Process > Variables > OrderBookingFault > payload > client:SOAOrderBookingProcessFault > client:status. In the To side, set Type to Variable, and select Variables > Process > Scope SetOrderStatus > Variables > orderStatusRequest > OrdersCollection > ns19:OrdersCollection > ns19:Orders >ns19:comments.
8-181
Figure 8261 Create Copy Operation Dialog for "AssignOrderStatus" Assign Activity, Third Copy Operation
You should see the three copy operations in the Assign dialog. Click OK.
Assign Dialog for "AssignOrderStatus" Activity
Figure 8262
Drag the Invoke icon from the Component Palette and drop it below the "AssignOrderStatus" assign activity in the catch area. Do one of the following to display the Invoke dialog:
Drag one of the arrows on the side of the new invoke activity and drop it on the "OrderStatus" database adapter. This associates the invoke activity with the database adapter. Double-click the new invoke activity.
3.
Name: enter SetFaultedOrderStatus. Partner Link: should be set to OrderStatus. If not, click the flashlight and select OrderStatus from the Partner Link Chooser.
Partner Link Chooser Dialog for the "SetFaultedOrderStatus" Invoke
Operation: select update. Input Variable: click the Browse Variables icon (the second icon from the left) and select Variables > Process > Scope - SetOrderStatus > Variables > orderStatusRequest.
8-183
Figure 8264 Variable Chooser Dialog for the Input Variable in the "SetFaultedOrderStatus" Invoke Activity
Click OK in the Variable Chooser. The Invoke dialog should look like this:
Figure 8265 Invoke Dialog for the "SetFaultedOrderStatus" Invoke Activity
4. 5.
Click OK in the Invoke dialog. Select File > Save to save your work.
1. 2. 3. 4. 5. 6.
Double-click the "SetFaultedOrderStatus" invoke activity to display the Invoke dialog. Click the Sensors tab in the Invoke dialog. Click Create to create a new sensor. This displays the Create Activity Sensor dialog. In the Create Activity Sensor dialog, set the Name to InstanceFaulted. Set the Evaluation Time to Completion. This specifies when the sensor fires. Completion signifies that the sensor fires after this activity has run. In the Activity Variable Sensors section, click Create to display the Create Activity Variable Sensor dialog.
Create Activity Variable Sensor Dialog
Figure 8266
7.
In the Create Activity Variable Sensor dialog, click the pencil icon for Variable XPath. This displays the Variable XPath Builder dialog.
Variable XPath Builder Dialog
Figure 8267
8. 9.
Select Variables > Process > Variables > OrderBookingFault. Click OK in the Variable XPath Builder. The Create Activity Variable Sensor dialog should be filled in with these values for you (see Figure 8266): Variable XPath: $OrderBookingFault Output Namespace: http://www.globalcompany.com/ns/OrderBooking
8-185
11. In the Create Activity Sensor dialog, click the Add icon in the Sensor Actions
section. This displays the Sensor Action Chooser dialog. It shows existing sensors called InstanceStart and InstanceCompleted, which you created in Section 8.6.2, "Create a Sensor for the Receive Activity" and Section 8.18.2, "Add a Sensor".
Figure 8269 Sensor Action Chooser Dialog
12. In the Sensor Action Chooser dialog, select Sensor Actions and select Sensor
Action from the wand icon. This displays the Create Sensor Action dialog.
13. In the Create Sensor Action dialog:
Name: enter InstanceFaulted. Publish Type: select JMS Topic. JMS Connection Factory: enter jms/TopicConnectionFactory. Publish Target: enter jms/demoTopic. Filter: leave blank. Enable: select this option.
Create Sensor Action Dialog
Figure 8270
14. Click OK in the Create Sensor Action dialog. The Sensor Action Chooser dialog
15. Click OK in the Sensor Action Chooser. This takes you back to the Create Activity
8-187
Figure 8272
In the Invoke dialog, the Sensors tab now looks like this:
Figure 8273 Invoke Dialog, Sensors Tab
17. Click OK in the Invoke dialog. 18. Select File > Save to save your work.
Double-click build.properties, located under SOAOrderBooking > Resources in the Application Navigator. This file defines values that are used by build.xml when you deploy the BPEL project.
2.
Uncomment (by removing the # character) these lines in the build.properties file:
platform=ias_10g domain=default rev=1.0 admin.user=oc4jadmin admin.password=welcome99 http.hostname=myAppServerMachine.mydomain.com http.port=8888 j2ee.hostname=myAppServerMachine.mydomain.com rmi.port=23793 opmn.requestport=6005 oc4jinstancename=home
3.
Edit the values as necessary. The values in bold italics are the typical values you need to modify. To determine the value for rmi.port, run:
ORACLE_HOME\opmn\bin\opmnctl status -l
ORACLE_HOME specifies the Oracle home for Oracle Application Server. To determine the value for opmn.requestport, see step 6 on page 2-11.
4. 5. 6. 7.
Select File > Save to save your changes to build.properties. Right-click build.xml, and select Run Ant. In the Run Ant dialog, click the Properties tab. In the Property Files section, click Add. In the Add Ant Property File dialog, select the build.properties file in the SOAOrderBooking directory and click Open. The Run Ant dialog should look like this:
Figure 8274
8.
Click OK. JDeveloper runs Ant to compile and deploy the project. If you get errors, see the next section, Section 8.20.1, "Deploying Using Ant from the Developer Prompt".
8-189
Select Start > Programs > Oracle - instanceName > Oracle BPEL Process Manager > Developer Prompt. This displays a shell window configured for Oracle BPEL Process Manager. Note that you must run ant from the Developer Prompt shell window to deploy the SOAOrderBooking project. Running ant from a regular operating system shell for deploying the project is not supported.
2.
In the Developer Prompt window, change directory to the SOADEMO\SOAOrderBooking directory, where SOADEMO refers to the directory where you created the SOA Order Booking application.
> cd SOADEMO > cd SOAOrderBooking
If you are running JDeveloper and Oracle Application Server on separate machines, you can copy the SOAOrderBooking directory from the JDeveloper machine to the Oracle Application Server machine. You can place it anywhere on the Oracle Application Server machine. In the Developer Prompt, you can just navigate to that directory.
3.
Run ant.
> ant
If you want to look at the WSDL for the SOAOrderBooking project, you can enter the following URL in a browser:
http://hostname:port/orabpel/default/SOAOrderBooking/1.0/SOAOrderBo oking?wsdl
8-191
9
Creating the OrderBookingESB Project
This chapter describes how to create the OrderBookingESB project. It contains these sections:
Section 9.1, "About the OrderBookingESB Project" Section 9.2, "Create a New Project for OrderBookingESB" Section 9.3, "Create a System Called "OrderBooking"" Section 9.4, "Create the "OrderBookingService" Routing Service" Section 9.5, "Invoke the SOAOrderBooking Process ("OrderBookingProcess" External Service)" Section 9.6, "Set up Routing Rules for OrderBookingService" Section 9.7, "Save All Files in the OrderBookingESB Project" Section 9.8, "Register the OrderBookingESB Project"
Right-click the SOADEMO application, and select New Project. In the New Gallery, in the Categories section, expand General and select Projects. In the Items section, select ESB Project.
Click OK.
3.
In the Create ESB Project dialog, enter OrderBookingESB in the Project Name field. Accept the defaults for the other fields.
Click OK.
9-2
JDeveloper displays a blank page for the OrderBookingESB.esb file. In the Application Navigator, this file is located under OrderBookingESB > Resources.
In the empty OrderBookingESB.esb page, click the Create System/Group icon, located at the top of the page.
2.
System: select this option. Name: enter OrderBooking. Description: leave blank or enter a brief description.
Figure 95 Create ESB System or Service Group Dialog for the "OrderBooking" System
3.
Click OK. In the Application Navigator, you should see an OrderBooking.esbsys file under OrderBookingESB > Resources.
Copy the following files from the soademo_101310_preview.zip file to the OrderBookingESB directory:
OrderBookingRequest.xsd OrderBookingPO.xsd
In the soademo_101310_preview.zip file, these xsd files are located in the OrderBookingESB directory.
2. 3. 4.
Select View > Component Palette to display the Component Palette. In the dropdown for the Component Palette, select ESB Services. Drag the Routing Service icon from the Component Palette and drop it anywhere on the OrderBookingESB.esb page. In the Create Routing Service dialog:
Name: enter OrderBookingService. System/Group: set to OrderBooking. Generate WSDL From Schemas: select this option. Schema Location: click Browse, which displays the Type Chooser dialog. In the dialog, select Project Schema Files > OrderBookingRequest.xsd > SOAOrderBookingProcessRequest.
Click OK in the Type Chooser dialog. Schema Location should be set to OrderBookingRequest.xsd.
9-4
5.
JDeveloper also creates a WSDL file for you: OrderBooking_ OrderBookingService.wsdl in the OrderBookingESB directory.
1. 2. 3.
Select ESB Services from the dropdown in the Component Palette. Drag the SOAP Service icon from the Component Palette and drop it to the right of the "OrderBookingService" routing service. In the Create SOAP Invocation Service dialog:
Name: enter OrderBookingProcess. System/Group: set to OrderBooking. WSDL File: Click the Service Explorer (flashlight) icon and in the Service Explorer dialog, select Service Explorer > BPEL Services > soaIntegrationServer > processes > default > SOAOrderBooking. soaIntegrationServer refers to the name of your Integration Server connection.
The Create SOAP Invocation Service dialog should look like this:
9-6
Figure 910
4.
Double-click OrderBookingService in the top section of the icon. This displays the page for the OrderBooking_OrderBookingService.esbsvc file. In the Routing Rules section, click the [+] to expand the section. In the Routing Rules section, click the green + icon. You may have to scroll to the right to see the icon.
Figure 912
Routing Rules
4.
In the Browse Target Service Operation dialog, select ESB > Services in project > OrderBooking > OrderBookingProcess > initiate.
Browse Target Service Operation Dialog
Figure 913
Click OK in the Browse Target Service Operation dialog. This returns you to the Routing Rules section, which should show "OrderBookingProcess::initiate" in the last column.
9-8
Figure 914 Routing Rules Showing the Link from OrderBookingService to OrderBookingProcess
5. 6.
In the Routing Rules section, click the filter icon. In the Expression Builder, in the WSDL Message section, select SOAOrderBookingProcessRequest_request > SOAOrderBookingProcessRequest > tns:SOAOrderBookingProcessRequest. Click Insert Into Expression. In the Expression box, you should see: /tns:SOAOrderBookingProcessRequest
Figure 915
Click OK in the Expression Builder. The routing rule now includes a filter, which simply passes the order information to the OrderBookingProcess activity. The routing rule section now looks like this, with the filter information in the first column.
Figure 916 Routing Rule Showing the Filter
7.
9-10
8.
Click the OrderBookingESB.esb tab. On the OrderBookingESB.esb page, you should see a line connecting the two activities:
Figure 917
Figure 918
***********************************************************************************************
9-12
10
Interfacing the Client Application with the SOA Order Booking Application
The focus of this chapter is how to get a client application such as the SOADemo-Client application to interface with the projects in the SOA Order Booking application. This chapter does not cover how to create the client application in detail because the client application uses the standard ADF technology, which is covered in detail in the ADF Developers Guide and ADF Tutorial. This chapter includes the following topics:
Section 10.1, "About the SOADemo-Client Application" Section 10.2, "Invoking Services from CustomerService" Section 10.3, "Invoking the OrderBookingESB Project" Section 10.4, "Deploying the Client Application"
CustomerService. In the login process, the client application uses the "find customer by email" service provided by CustomerService to validate the customers login ID and password. CustomerService. The SOADemo-Client application provides a Register button that enables new customers to add themselves to the database. The Register button invokes the "add new customer" service provided by CustomerService. OrderBookingESB. When the customer submits an order, it invokes the OrderBookingESB project. The OrderBookingESB project in turn invokes the SOAOrderBooking BPEL process, which is the main flow for the SOA Order Booking application.
Interfacing the Client Application with the SOA Order Booking Application 10-1
For the SOADemo-Client application to be able to invoke services provided by CustomerService and OrderBookingESB, you have to generate web service proxies for the services. In the code for the client, you call methods in the web service proxy, which then invokes the corresponding methods in CustomerService or OrderBookingESB. You can use JDeveloper to generate web service proxies.
Section 10.2.1, "Generate a Web Service Proxy for CustomerService" Section 10.2.2, "Build the Files" Section 10.2.3, "Write Code to Invoke the Web Service Proxy for CustomerService"
Create a project in your client application to contain the web service proxy for CustomerService. Begin by creating an empty project:
a. b.
Right-click the client application, and select New Project. In the New Gallery, in the Categories section, expand General and select Projects. In the Items section, select Empty Project.
New Gallery for Creating an Empty Project
Figure 101
Click OK.
c.
In the Create Project dialog, enter CustomerService in the Project Name field.
10-2
Figure 102
Create Project Dialog for the CustomerService Web Service Proxy Project
Click OK. In the Application Navigator, you should see an empty CustomerService project located under the client application.
2.
Right-click the CustomerService project, and select New. In the New Gallery, in the Categories section, expand Business Tier and select Web Services. In the Items section, select Web Service Proxy.
New Gallery for Creating a Web Service Proxy
Figure 103
Click OK. This launches the Create Web Service Proxy wizard. Click Next to continue.
3.
WSDL Document URL: enter the following URL: http://host:port/CustomerService/CustomerService?WSDL host specifies the name of the machine running Oracle Application Server, and port specifies the HTTP at which Oracle HTTP Server or OC4J is listening.
Interfacing the Client Application with the SOA Order Booking Application 10-3
Figure 104
Click Next. If nothing happens, click the UDDI button. This pops up another wizard. Click Cancel in that wizard. Now click Next again.
4.
In Step 2, Port Endpoints, select Run against a service deployed to an external server, and click Next.
Create Web Service Proxy Wizard, Step 2: Port Endpoints
Figure 105
5.
10-4
Figure 106
6.
Figure 107
7.
Package Name: enter oracle.soademo.view.services. Root Package for Generated Types: enter oracle.soademo.view.services.runtime. Select all the options on the page: Generate Data Binding Classes Reuse Existing Type Classes Unwrap Wrapped Parameters Map Headers to Parameters
Interfacing the Client Application with the SOA Order Booking Application 10-5
Figure 108
Click Next.
8.
In Step 6, Support Files, select Generate JUnit Unit Test Code only if you want to write test cases using JUnit. Note that to be able to compile the files that use JUnit classes, you need to download the JUnit library files from an external site (for example, http://www.junit.org). Click Next.
Figure 109
9.
JDeveloper creates the web service proxy files in src directory of the project.
If you selected Generate JUnit Unit Test Code in step 8 on page 10-6, then you need to download JUnit from an external site (for example, http://www.junit.org).
10-6
Add the JUnit jar file to the project before building the project. To add the jar file to the project, right-click the CustomerService project in the client and select Project Properties. In the Project Properties dialog, select Libraries on the left side, and click Add Jar/Directory on the right side. Select the JUnit jar file to add to the project.
2.
10.2.3 Write Code to Invoke the Web Service Proxy for CustomerService
The main web service proxy file for CustomerService is src\oracle\soademo\view\services\CustomerServiceClient.java. This file lists the methods provided by CustomerService. Your client application can call the methods in this class, and you deploy your client application with the web service proxy. The SOADemo-Client application invokes the web service proxy for CustomerService in two places:
Section 10.2.3.1, "Verifying the Login" Section 10.2.3.2, "Registering New Customers"
Interfacing the Client Application with the SOA Order Booking Application 10-7
} } catch (Exception ex) { FacesMessage msg = new FacesMessage("Login Failed!"); msg.setSeverity(msg.SEVERITY_ERROR); FacesContext.getCurrentInstance().addMessage(null, msg); //ex.printStackTrace(); return null; } // Set CurrentUser mananged bean properties JSFUtils.setManagedBeanValue(ctx,"Current_User.loggedIn",true); JSFUtils.setManagedBeanValue(ctx,"Current_User.userid", emailId.getValue().toString()); JSFUtils.storeOnSession(ctx, AUTH_USER, "Authorized_User"); return "success"; }
10-8
newCust.setAddressList(addrList); myPort.addNewCustomer(newCust); // Generate successful registration message FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Registration Successful!")); } catch (Exception ex) { FacesMessage msg = new FacesMessage("Registration Failed!"); msg.setSeverity(msg.SEVERITY_ERROR); FacesContext.getCurrentInstance().addMessage(null, msg); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(ex.getMessage())); ex.printStackTrace(); } //Store customer info on session JSFUtils.storeOnSession(ctx, "custinfo", newCust); // Set CurrentUser mananged bean properties JSFUtils.setManagedBeanValue(ctx,"Current_User.loggedIn",true); JSFUtils.setManagedBeanValue(ctx,"Current_User.userid", email.getValue().toString()); JSFUtils.storeOnSession(ctx, AUTH_USER, "Authorized_User"); } else { // Generate password mismatch msg FacesMessage msg = new FacesMessage("Your password values do not match!"); msg.setSeverity(msg.SEVERITY_ERROR); FacesContext.getCurrentInstance().addMessage(null, msg); } }
Access the ESB Console using the following URL: http://hostname:port/esb/esb/EsbConsole.html hostname specifies the name of the machine running Oracle Application Server, and port specifies the HTTP port at which Oracle HTTP Server or OC4J is listening.
2. 3.
On the left side of the ESB Console, select OrderBookingService. This is the starting point for the OrderBookingESB project. On the right side of the ESB Console, select the Definition tab. You should see a page that looks something like Figure 1010:
Interfacing the Client Application with the SOA Order Booking Application 10-9
Figure 1010
4.
Copy the concrete URL so that you can paste it in the Create Web Service Proxy wizard. You can also click the URL if you want to see what the WSDL looks like.
10.3.2 Create the Project in the Client and Create the Web Service Proxy
1.
Create a project in your client application to contain the web service proxy for OrderBookingESB. Begin by creating an empty project in your client application:
a. b.
Right-click the client application, and select New Project. In the New Gallery, in the Categories section, expand General and select Projects. In the Items section, select Empty Project.
Figure 1011
Click OK.
c.
In the Create Project dialog, enter OrderService in the Project Name field.
Create Project Dialog for the OrderService Web Service Proxy Project
Figure 1012
Click OK. In the Application Navigator, you should see an empty OrderService project located under the client application.
2.
Right-click the OrderService project, and select New. In the New Gallery, in the Categories section, expand Business Tier and select Web Services. In the Items section, select Web Service Proxy.
Interfacing the Client Application with the SOA Order Booking Application 10-11
Figure 1013
Click OK. This launches the Create Web Service Proxy wizard. Click Next to continue.
3.
WSDL Document URL: enter the URL for OrderBookingESB. Section 10.3.1, "Retrieve the Concrete WSDL URL" describes how to obtain this URL. Mapping File: leave it blank. Copy WSDL Into Project: do not select this option.
Create Web Service Proxy Wizard, Step 1: Web Service Description
Figure 1014
Click Next. If nothing happens, click the UDDI button. This pops up another wizard. Click Cancel in that wizard. Now click Next again.
4.
In Step 2, Port Endpoints, select Run against a service deployed to an external server. In Endpoint URL, edit the URL as follows:
Replace localhost with the name of the machine running the OrderBookingESB project. Verify and correct the port number, if necessary.
Click Next.
Figure 1015 Create Web Service Proxy Wizard, Step 2: Port Endpoints
5.
Figure 1016
6.
Interfacing the Client Application with the SOA Order Booking Application 10-13
Figure 1017
7.
Package Name: enter oracle.soademo.view.services. Root Package for Generated Types: enter com.globalcompany.ns.order. Select all the options on the page: Generate Data Binding Classes Reuse Existing Type Classes Unwrap Wrapped Parameters Map Headers to Parameters
Create Web Service Proxy Wizard, Step 5, Default Mapping Options
Figure 1018
Click Next.
8.
In Step 6, Support Files, select Generate JUnit Unit Test Code only if you want to write test cases using JUnit. Note that to be able to compile the files that use JUnit classes, you need to download the JUnit library files from an external site (such as http://www.junit.org).
Click Next.
Figure 1019 Create Web Service Proxy Wizard, Step 6, Support Files
9.
If you selected Generate JUnit Unit Test Code in step 8 on page 10-14, then you need to download JUnit from an external site (for example, http://www.junit.org). Add the JUnit jar file to the project before building the project. To add the jar file to the project, right-click the OrderService project in the client and select Project Properties. In the Project Properties dialog, select Libraries on the left side, and click Add Jar/Directory on the right side. Select the JUnit jar file to add to the project.
2.
10.3.4 Write Code to Invoke the Web Service Proxy for OrderBookingESB
On the Shopping Cart page in the SOADemo-Client application, customers click the Place Order button to submit their order. This button invokes the PlaceOrder_ action method in ShoppingCart.java (located in the SOADEMO-CLIENT\UserInterface\src\oracle\soademo\view\backing directory). The PlaceOrder_action method:
creates an instance of __soap_initiate_pptClient, which is the proxy for OrderBookingESB. This class was generated by the Web Service Proxy wizard. You should check the name of the generated file in your environment. The name of the class may be slightly different (for example, __soap_ OrderBookingService_initiate_pptClient.java).
gets the order information from the shopping cart gets the customer information from the session creates a purchase order and populates it with the order and customer information
Interfacing the Client Application with the SOA Order Booking Application 10-15
calls initiate on the proxy to invoke OrderBookingESB sets the shopping cart to empty.
The lines in bold show the places where the code invokes the web service proxy.
public String PlaceOrder_action() { // Place order FacesContext ctx = FacesContext.getCurrentInstance(); // Get order items from Cart Cart cartBean = (Cart) JSFUtils.getManagedObject("Shopping_Cart"); List CartItemList = cartBean.getItemList(); // Get Customer info from session Customer currentCustomer = (Customer) JSFUtils.getFromSession(ctx, "custinfo"); try { oracle.soademo.view.services.__soap_initiate_pptClient myPort = new oracle.soademo.view.services.__soap_initiate_pptClient(); System.out.println("calling " + myPort.getEndpoint()); PurchaseOrderType po = new PurchaseOrderType(); // Customer ID po.setCustID(currentCustomer.getCustid()); // Need to randomly set ID for now since WS won't auto-assign po.setID("" + (int)(Math.random() * 1000)); // Order Info OrderInfoType order = new OrderInfoType(); order.setOrderPrice(cartBean.getOrderTotal()); order.setOrderComments("This order was issued from the SOA Retail Client."); Calendar caldate = Calendar.getInstance(); order.setOrderDate(caldate); order.setOrderStatus("pending"); po.setOrderInfo(order); // Order Items OrderItemsType oitems = new OrderItemsType(); ItemType[] items = new ItemType[CartItemList.size()]; for (int i = 0; i < CartItemList.size(); i++) { items[i] = (ItemType) CartItemList.get(i); } oitems.setItem(items); po.setOrderItems(oitems); // Supplier Info // For now hard code fictional Supplier SupplierInfoType supplier = new SupplierInfoType(); supplier.setSupplierName("Express Deliveries"); // Supplier has 10% discount supplier.setSupplierPrice(cartBean.getOrderTotal(). subtract(cartBean.getOrderTotal().movePointLeft(1)));
po.setSupplierInfo(supplier); // Contact Info ContactType contact = new ContactType(); contact.setEmailAddress(currentCustomer.getEmail()); contact.setPhoneNumber(currentCustomer.getPhonenumber()); po.setUserContact(contact); // Initiate Order myPort.initiate(po); System.out.println("Order submitted..."); } catch (Exception ex) { ex.printStackTrace(); } // report success ctx.addMessage(null, new FacesMessage("Order Submitted!")); cartBean.EmptyCart(); return "home"; }
In JDeveloper, open SOADEMO-CLIENT\SOADEMO-CLIENT.jws. This is the project file for the SOADEMO-Client application. This step is required only if you meet any of these conditions:
You are running JDeveloper and Oracle Application Server on different machines. Your Oracle Application Server installation is listening for HTTP requests on a port other than 8888.
If you meet either or both of the conditions above, you need to perform these steps:
a.
Edit these files: SOADEMO-CLIENT\CustomerService\src\oracle\soademo\view\se rvices\runtime\CustomerServiceSoapHttp_Stub.java In JDeveloper, you can access this file from the Application Navigator as follows: i. In JDeveloper, select View > Structure to display the Structure window. ii. In the Application Navigator, select SOADEMO-CLIENT > CustomerService > Application Sources > oracle.soademo.view > services > CustomerSvcProxy. iii. Double-click CustomerServiceSoapHttp_Stub.java in the Structure window. SOADEMO-CLIENT\OrderService\src\oracle\soademo\view\servi ces\runtime\__soap_initiate_ppt_Stub.java
Interfacing the Client Application with the SOA Order Booking Application 10-17
In JDeveloper, you can access this file from the Application Navigator as follows: i. In JDeveloper, select View > Structure to display the Structure window. ii. In the Application Navigator, select SOADEMO-CLIENT > OrderService > Application Sources > oracle.soademo.view > services > Initiate_ pptServiceProxy. iii. Double-click __soap_initiate_ppt_Stub.java in the Structure window. Make the following changes in the files: Search for "localhost" and replace it with the fully qualified name (including the domain name) of the machine running Oracle Application Server. Search for "8888" and replace it with the HTTP port for your environment.
b.
c.
Regenerate the files you just deleted. i. Expand SOADEMO-CLIENT > UserInterface > Resources. ii. Right-click soaui.deploy and select Deploy to WAR File. iii. Right-click soaui.deploy and select Deploy to EAR File.
3. 4.
Expand SOADEMO-CLIENT > Assembly > Application Sources. Right-click SOADEMO.deploy and select Deploy To > ApplicationServerConnection, where ApplicationServerConnection specifies the connection to your Oracle Application Server installation. Click OK in the Configure Application dialog.
5.