Oracle® Fusion Middleware Tutorial for Running and Building an Application with Oracle SOA Suite 11g Release 1 (11.1.1) Part Number E10275-02 |
|
|
View PDF |
The WebLogic Fusion Order Demo application of the Fusion Order Demo demonstrates using Oracle SOA Suite for processing orders from a Web shopping store front. This tutorial focuses on running and building the WebLogic Fusion Order Demo application.
This chapter contains the following sections:
For an overview of Oracle SOA Suite, see Oracle Fusion Middleware Getting Started with Oracle SOA Suite.
Run by a fictitious company called Global Company, the Fusion Order Demo provides two main parts, the Store Front module and the WebLogic Fusion Order Demo application.
The StoreFront module sells electronic devices through a storefront-type Web application.
The StoreFront module contains the following projects:
StoreFrontService
: This project provides access to the storefront data and provides transaction support to update data for customers, orders, and products.
StoreFrontUI
: This project provides Web pages that the customer uses to browse the storefront, place orders, register on the site, view order information, and update the user profile.
The StoreFrontUI
project uses JavaServer Faces (JSF) as the view technology, and relies on the Oracle ADF Model layer to interact with Oracle Application Development Framework (Oracle ADF) Business Components in the StoreFrontService
project.
For a detailed description of the StoreFront module and its projects, see the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.
Once a customer places an order, the WebLogic Fusion Order Demo application processes the order.
To prepare for the creation of the WebLogic Fusion Order Demo application, complete the following tasks.
Install Oracle JDeveloper 11g Studio Edition to create the WebLogic Fusion Order Demo application. You can download Oracle JDeveloper from:
http://www.oracle.com/technology/products/jdev/11/index.html
Ensure that you download and install 11g and that it is the Studio Edition, not the Java Edition. You can verify these details in Oracle JDeveloper from the Help > About menu option.
In order to create and deploy SOA composite applications and projects, you must install the Oracle SOA Suite extension. For instructions on installing this extension for Oracle JDeveloper, see the Oracle Fusion Middleware Installation Guide for Oracle JDeveloper.
Throughout this tutorial, you must view or use content from Fusion Order Demo in your Oracle JDeveloper environment. The Fusion Order Demo is contained within a ZIP file.
To access the ZIP file:
Download the Fusion Order Demo application ZIP file (FusionOrderDemo_R1.zip
). You can download the ZIP file from:
http://www.oracle.com/technology/products/jdev/samples/fod/index.html
Unzip the file to a temporary directory.
This tutorial refers to this directory as DEMO_DOWNLOAD_HOME
. When you create the WebLogic Fusion Order Demo application, create the application in a working application directory, such as C:\fod
. This tutorial refers to the working application directory location as MY_FOD_HOME
. When requested, copy needed files from the DEMO_DOWNLOAD_HOME
directory to MY_FOD_HOME
.
To successfully deploy and run the Fusion Order Demo applications, you must complete an installation for Oracle SOA Suite. Installing Oracle SOA Suite requires creating schemas for Oracle SOA Suite in an Oracle database, installing Oracle WebLogic Server, installing Oracle SOA Suite, and configuring a domain in Oracle WebLogic Server to support both Oracle SOA Suite and Oracle Enterprise Manager. Specifically, the domain contains an Administration Server and a Managed Server. The Administration Server hosts Oracle Enterprise Manager Fusion Middleware Control for performing administrative tasks; the Managed Server is an instance of an Oracle WebLogic Server used to host deployed applications. For instructions on installing and configuring Oracle SOA Suite, see the Oracle Fusion Middleware Installation Guide for Oracle SOA Suite.
After successfully completing the installation process, perform the following additional configuration steps:
Enable the credentials that are included in the StoreFront module by adding a setting to the configuration file for the domain:
Locate the configuration file set for the Oracle SOA Suite domain in the following directory:
(UNIX) MW_HOME/user_projects/domains/domain_name/bin/setDomainEnv.sh (Windows) MW_HOME\user_projects\domains\domain_name\bin\setDomainEnv.cmd
Add the following option to the JAVA_PROPERTIES
(UNIX) or the SET JAVA_PROPERTIES
(Windows) line:
-Djps.app.credential.overwrite.allowed=true
If the Oracle WebLogic Server Administration Server is running, stop it:
On UNIX, as the root user, change directories to directory MW_HOME
/user_projects/domains/
domain_name
/bin
and enter the following command:
./stopWebLogic.sh
On Windows, from the Windows Start menu, select All Programs > Oracle WebLogic > User Projects > domain_name > Stop Admin Server.
Start the Administration Server:
On UNIX, from directory MW_HOME
/user_projects/domains/
domain_name
/bin
, enter the following command:
./startWebLogic.sh
On Windows, from the Windows Start menu, select All Programs > Oracle WebLogic > User Projects > domain_name > Start Admin Server.
When prompted on UNIX, enter your Oracle WebLogic Server user name and password. The password is not visible as you type.
The Administration Server is started when the command window displays the following messages:
<Server state changed to RUNNING> <Server started in RUNNING mode>
Leave the command window open, although you may minimize it. The Administration Server is now running and ready for use.
When the Administration Server is in RUNNING
mode, start the SOA managed server, if it is not running. In a command window, enter the following command all on one line:
On UNIX, from directory MW_HOME
/user_projects/domains/
domain_name
/bin
, enter the following command:
./startManagedWebLogic.sh managed_server_name admin_url username password
On Windows, from directory MW_HOME
\user_projects\domains\
domain_name
\bin
, enter the following command:
startWebLogic.cmd managed_server_name admin_url username password
Substitute the following values:
Element | Value |
---|---|
managed_server |
The name of the Managed Server. For example:
|
admin_url |
The URL of the Oracle WebLogic Server. For example:
|
username |
The Oracle WebLogic Server administrator. For example:
|
password |
The password of the Oracle WebLogic Server administrator. For example:
|
If you are deploying remotely from one computer that has Oracle JDeveloper to another computer that has the Oracle SOA Suite installation with Oracle WebLogic Server, modify the JAVA_HOME
and PATH
environment variables on the computer with the Oracle SOA Suite installation.
Oracle JDeveloper requires changes to these variables for running the scripts that deploy the composite services. You set the JAVA_HOME
variable to include the path to the Oracle WebLogic Server JDK, and set the PATH
variable to include the path to the Oracle WebLogic Server bin
directory for ant
.
On UNIX, use the export
command. For example:
export JAVA_HOME=$MW_HOME/jdk160_11 export PATH=$PATH:MW_HOME/modules/org.apache.ant_1.7.0/bin
On Windows, perform the following steps to modify the variables:
Open Control Panel from the Windows Start menu and double-click the System icon.
In the System Properties dialog, select the Advanced tab and click Environment Variables.
In the Environment Variables dialog, locate the JAVA_HOME
system variable and ensure that it is set to the location of the Oracle WebLogic Server JDK.
If there is no JAVA_HOME
variable defined, click New and in the New System Variable dialog, enter a variable name of JAVA_HOME
and a variable value pointing to the Oracle WebLogic Server JDK, such as C:\weblogic\jdk160_11
. Click OK to set the new system variable.
Double-click the Path
system variable and ensure that it includes the path to the Oracle WebLogic Server ant\bin
directory. If it does not, add the path to the end of the variable value. For example:
;C:\weblogic\modules\org.apache.ant_1.7.0\bin
Click OK to set the new system variable.
Click OK twice more to dismiss the Environment Variables and the System Properties dialogs.
To create a connection to the Oracle WebLogic Server configured for Oracle SOA Suite during installation.
Start Oracle JDeveloper:
(UNIX) ORACLE_HOME/jdev/bin/jdev (Windows) JDEV_ORACLE_HOME\jdeveloper\JDev\bin\jdev.exe
From the Application Menu, select New.
In the New Gallery dialog, in the Categories tree, select General, and then Connections.
Select Application Server Connection and click OK.
The Create Application Server Connection Type page displays.
Enter MyAppServerConnection
in the Connection Name field and select WebLogic 10.3 from the Connection Type list.
Click Next.
The Authentication page is displayed.
Enter weblogic
for the User Name and the password for that administrator in the Password field.
In the Configuration page, enter the following values:
Element | Value |
---|---|
Weblogic Hostname (Administration Server) | Name of the DNS name or IP address of the Administration Server of the Oracle WebLogic Server |
Port | The address of the port on which the Administration Server is listening for requests (7001 by default) |
WLS Domain | The domain name for Oracle WebLogic Server |
Click Next.
The Test page displays.
Click Test Connection.
The following message should appear:
Testing JSR-88 ... success. Testing JSR-88-LOCAL ... success. Testing JNDI ... success. Testing JSR-160 DomainRuntime ... success. Testing JSR-160 Runtime ... success. Testing JSR-160 Edit ... success. Testing HTTP ... success. Testing Server MBeans Model ... success. 8 of 8 tests successful.
If the test is unsuccessful, ensure that Oracle WebLogic Server is running, and retry the test.
Click Finish.
In the Resource Palette, under IDE Connections, expand Application Server to see the application server connection that you created.
This tutorial focuses on building the WebLogic Fusion Order Demo application for Fusion Order Demo. To begin, spend time viewing the WebLogicFusionOrderDemo
application artifacts in Oracle JDeveloper:
Start Oracle JDeveloper.
From the JDeveloper main menu, choose File > Open.
In the Open dialog, browse to DEMO_DOWNLOAD_HOME
/CompositeServices
and select WebLogicFusionOrderDemo.jws. Click Open.
The following figure shows the Application Navigator after you open the file for the application workspace.
Table 1-1 describes each of the projects in the WebLogicFusionOrderDemo
application workspace:
Table 1-1 Projects in the WebLogicFusionOrderDemo Application
Project | Description |
---|---|
This project contains a composite for Oracle B2B. This composite is not used in this tutorial. |
|
This project contains the |
|
This project contains a build script for deploying all the SOA projects. It also contains templates for seeding JMS connector information, demo topics, and demo users. |
|
This project provides the service needed by |
|
This project provides a task form for approving orders from the |
|
This project processes an order submitted in the Store Front module UI. This project contains the main process for the WebLogic Fusion Order Demo application. |
|
This project simulates the |
|
This project contains a composite containing a BPEL process for obtaining a quote from a partner warehouse. It is referenced as a service from the composite for the |
From the Application Menu, select Close to close the sample application.
Composites enable you to easily assemble multiple technology components into one SOA application. A composite groups service components and uses wires to connect components. OrderBookingComposite
is the main project of the WebLogic Fusion Order Demo application, containing a composite application for processing orders from Global Company. This composite demonstrates how services, both internal to an enterprise, and external at other sites, can be integrated using the SOA architecture paradigm to create one cohesive ordering system.
The OrderBookingComposite
composite utilizes the following Oracle SOA Suite components:
Oracle Mediator
Oracle BPEL Process Manager
Oracle Human Workflow (using a human task)
Oracle Business Rules
Oracle Messaging Service
At the center of OrderBookingComposite
composite is the OrderProcessor
BPEL process. It orchestrates all the existing services in the enterprise for order fulfillment with the right warehouse, based on the business rules in the process.
Figure 1-1 shows an overview of the OrderBookingComposite
composite for the WebLogic Fusion Order Demo application, followed by a step-by-step description of the composite flow for how the application processes an order.
When a new customer registers in Global Company's storefront UI, the Web client sends the customer's information to the internal customer service application called StoreFrontService
. StoreFrontService
then stores the customer information in a database. The customer can then browse products, add them to their online shopping cart, and place the order.
When a registered customer attempts onto Global Company's storefront UI, the UI invokes the StoreFrontService
and provides authentication. A registered user builds up their shopping cart, and places an order. When the order is submitted, the following events take place:
After an order is placed, the following sequence occurs to complete the order:
Oracle ADF Business Component writes the order to a database with schema for Fusion Order Demo, and raises a NewOrderSubmitted
event using the Event Delivery Network (EDN). The data associated with this event is the order ID.
Because the OrderPendingEvent
mediator subscribes to the NewOrderSubmitted
event, the EDN layer notifies the OrderPendingEvent
mediator of the new order.
The OrderPendingEvent
mediator receives the order and routes the input order ID to the OrderProcessor
BPEL process.
The OrderProcessor
BPEL process receives the order ID from the database, using a bind entity activity to bind to the exposed Oracle ADF Business Component StoreFrontService
service.
Some of the information about the order used later in the process is:
Customer ID
Items the customer purchased
Credit card used
Shipping address chosen
The BPEL process initiates StoreFrontService
, passing it the order ID, to retrieve information about the customer.
The BPEL process then sends the purchase amount, credit card type, and credit card number to CreditCardAuthorizationService
, which verifies if the customer's credit card is valid.
If credit card is not valid, the BPEL process cancels the order.
If credit card is valid, the BPEL process sends the order to the RequiresApprovalRule
business rule to determine if the order requires approval by management.
The RequiresApprovalRule
business rule evaluates if manual approval is required. The business rule contains a rule that requires manual approval for orders over $2,000.
For those orders requiring manual approval, the BPEL process invokes the ApprovalHumanTask
human task, which routes a message to a manager, who then approves or disapproves the order.
If the order is approved, the BPEL process sends the order information to the following suppliers in parallel to obtain a bid:
Internal supplier by using the InternalWarehouseService
BPEL process, also located in OrderBookingComposite
External supplier by using the PartnerSupplierMediator
mediator, which in turn routes to the ExternalPartnerSupplier
BPEL process, located in another composite called PartnerSupplierComposite
The two suppliers respond with their bids, and the BPEL process send the bids to the EvaluatePreferredSupplierRule
business rule.
The EvaluatePreferredSupplierRule
business rule chooses the supplier with the lower of the two bids.
The BPEL process invokes the FulfillOrder
mediator, which performs the following two operations:
Stores the order in a temporary queue and uploads it to the fulfillment system in batch mode overnight
Routes the order to USPS
Once the order is fulfilled, the BPEL process sets the order to complete
.
The BPEL process invokes the NotificationService
service, which sends the customer an E-mail notification with the purchase order information.
When the order completes, the OrderPendingEvent
mediator publishes the OrderCompleted
business for the OrderProcessor
process.
When an order is updated, the following occurs:
The UpdateOrderStatus
mediator publishes business event OrderUpdateEvent
and sends the order ID to the OrderProcessor
BPEL process.
The OrderUpdateEventMediator
mediator subscribes to business event OrderUpdateEvent
, sends the order ID to StoreFrontService
, and waits for the StoreFrontService
to respond with updated details about the order.