3 Introduction to the SOA Sample Application

This chapter describes how to set up, deploy, and run the SOA sample application that can be used with this guide. The WebLogic Fusion Order Demo application of the Fusion Order Demo demonstrates various capabilities of Oracle SOA Suite and is used as an example throughout this guide.

3.1 Introduction to the Fusion Order Demo

The WebLogic Fusion Order Demo application is part of a larger sample application called Fusion Order Demo. In this larger sample application, Global Company sells electronic devices through many channels, including a web-based client application. Electronic devices are sold through a store front-type web application. Customers can visit the web site, register, and place orders for the products.

There are two parts to the Fusion Order Demo:

Store Front module

WebLogic Fusion Order Demo application

3.1.1 Store Front Module

The Store Front module provides a rich user interface built with Oracle Application Development Framework (ADF) to show how to combine an easily built AJAX user interface with a sophisticated SOA composite application. It is based on Oracle ADF business components, ADF model data bindings, and ADF faces.

StoreFrontService: This project provides access to the store front 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.

Figure 3-1 shows the Home page of the Store Front module user interface. It shows the featured products that the site wants to promote and provides access to the full catalog of items. Products are presented as images along with the name of the product. Page regions divide the product catalog area from other features that the site offers.

From the home page, you can browse the web site as an anonymous user, then log in as a registered customer to place an order.

The Fusion Order Demo application ships with predefined customer data. Because the Fusion Order Demo application implements Oracle ADF security to manage access to Oracle ADF resources, only the authenticated user can view orders in their cart.

3.1.2 WebLogic Fusion Order Demo Application

The WebLogic Fusion Order Demo application processes orders placed in the Store Front module. It uses the following Oracle SOA Suite components:

Oracle Mediator

Oracle BPEL process

Human workflow (using a human task)

Oracle Business Rules

Spring

Oracle User Messaging Service

Oracle Business Activity Monitoring

Oracle Metadata Services Repository

Once an order has been placed by using the Store Front module, the WebLogic Fusion Order Demo application processes the order. When processing an order, it uses various internal and external applications, including a customer service application, a credit validation system, and both an internal vendor and external vendor. For example, the internal vendor (InternalWarehouseService) and external vendor (ExternalPartnerSupplier), are sent information for every order. As part of the order process, they each return a price for which they would supply the items in the order. A condition in the process determines which supplier is assigned the order.

3.2.3 Task 3: Install Oracle SOA Suite

To successfully deploy and run the Fusion Order Demo applications, you must complete an installation for Oracle SOA Suite. Specifically, the domain contains an Administration Server and a Managed Server.

Installing Oracle SOA Suite requires the following:

Creating schemas for Oracle SOA Suite in an Oracle database

Installing Oracle WebLogic Server

Configuring a domain in Oracle WebLogic Server to support Oracle SOA Suite, Oracle Enterprise Manager, and optionally, Oracle BAM. Oracle BAM is not required for the Fusion Order Demo, but if an Oracle BAM Server is configured, Oracle BAM adapters send data to the Oracle BAM Server.

After the domain is created, it contains an Administration Server to host Oracle Enterprise Manager Fusion Middleware Control for performing administrative tasks, a Managed Server to host deployed applications, and, if you configured Oracle BAM, a second Managed Server for the Oracle BAM Server.

The port of the Managed Server for hosting SOA applications is typically 8001. The port of the Managed Server for Oracle BAM is typically 9001.

username

The Oracle WebLogic Server administrator. For example:

weblogic

password

The password of the Oracle WebLogic Server administrator. For example:

welcome1

If you are deploying remotely from one host that has Oracle JDeveloper to another host that has the Oracle SOA Suite installation with Oracle WebLogic Server, modify the JAVA_HOME and PATH environment variables on the host 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.

Open the 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.

3.3 Taking a Look at the WebLogic Fusion Order Demo Application

After you have set up the WebLogic Fusion Order Demo application, spend time viewing the WebLogic Fusion Order Demo artifacts in Oracle JDeveloper.

To open the WebLogic Fusion Order Demo in Oracle JDeveloper:

From the Oracle JDeveloper main menu, choose File > Open.

In the Open dialog, browse to DEMO_DOWNLOAD_HOME/CompositeServices and select WebLogic Fusion Order Demo.jws.

Click Open.

When prompted to migrate files to the 11.1.1.6.0 format, click Yes. When the migration is complete, click OK.

Figure 3-2 shows the Application Navigator after you open the file for the application workspace. It displays the project applications of the WebLogic Fusion Order Demo.

3.3.1 Project Applications of the WebLogic Fusion Order Demo Application

Table 3-2 lists and describes the projects in the WebLogicFusionOrderDemo application workspace.

Table 3-2 Projects in the WebLogic Fusion Order Demo Application

Application

Description

B2BX12OrderGateway

This project contains a composite for Oracle B2B. This composite is not used in this guide.

bin

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.

CreditCardAuthorization

This project provides the service needed by the OrderBookingComposite project to verify the credit card information of a customer.

ExternalLegacyPartnerSupplierEjb

This project provides an external system to provide price quotes.

OrderApprovalHumanTask

This project provides a task form for approving orders from the OrderBookingComposite project.

OrderBookingComposite

This project processes an order submitted in the Store Front module user interface. This project contains the main process for the WebLogic Fusion Order Demo application. It also uses the Oracle BAM adapter and Oracle BAM sensors to send active data into the Oracle BAM dashboard. This composite is not used in this guide.

OrderSDOComposite

This project simulates the StoreFrontService service of the Store Front module for testing purposes.

PartnerSupplierComposite

This project contains a composite containing both a BPEL process and spring context for obtaining a quote from a partner warehouse. It is referenced as a service from the composite for the OrderBookingComposite project. The quote request is routed to either the BPEL process or the spring component based on the amount.

3.3.2 The composite.xml File

To understand how a composite is designed, examine the main project, OrderBookingComposite, in Oracle JDeveloper.

To view the composite.xml file:

In Application Navigator, expand OrderBookingComposite > SOA Content.

Select OrderBookingComposite(composite.xml).

The composite then appears in the SOA Composite Editor in Oracle JDeveloper, as shown in Figure 3-3.

3.4 Understanding the OrderBookingComposite Flow

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.

At the center of OrderBookingComposite 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 3-4 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 store front user interface, 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. User ngreenbe is the only user not required to register before placing an order.

When a registered customer uses Global Company's store front user interface, the user interface invokes the StoreFrontService and provides authentication. A registered user fills 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 Oracle Mediator subscribes to the NewOrderSubmitted event, the EDN layer notifies the OrderPendingEvent Oracle Mediator of the new order.

The OrderPendingEvent Oracle 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 the credit card is not valid, the BPEL process cancels the order.

If the 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 in turn performs the following:

Routes a message to an assignee named jstein, who then approves or disapproves the order.

Publishes the OnTaskAssigned event. The OrderApprovalTaskAssignedMediator Oracle Mediator subscribes to this event, and if an Oracle BAM Server is configured, it uses an Oracle BAM adapter to send the assignee ID jstein (based on the ECID) of the order to the Oracle BAM Server.

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 Oracle Mediator, which in turn routes to the ExternalPartnerSupplier BPEL process or SpringPartnerSupplierMediator spring component, located in another composite called PartnerSupplierComposite

The two suppliers respond with their bids, and the BPEL process sends 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 Oracle Mediator, which performs the following four operations:

Stores the order in a temporary queue and uploads it to the fulfillment system in batch mode overnight.

Routes the order to USPS.

If an Oracle BAM Server is configured, it uses an Oracle BAM adapter to send data about the order (based on order ID) to the Oracle BAM Server.

If an Oracle BAM Server is configured, it uses an Oracle BAM adapter to send data about the time for the order to process (based on the instance ID) to the Oracle BAM Server.

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 email notification with the purchase order information.

When the order completes, the OrderPendingEvent Oracle Mediator publishes the OrderCompleted business for the OrderProcessor process.

While not depicted in Figure 3-4, the OrderBookingComposite composite provides the following processing flow for approved orders:

The UpdateOrderStatus Oracle Mediator performs the following:

Publishes business event OrderUpdateEvent and sends the order ID to the OrderProcessor BPEL process.

If an Oracle BAM Server is configured, it uses an Oracle BAM adapter to send data about the order ID and order status to the Oracle BAM Server.

The OrderUpdateEventMediator Oracle 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.

To aid with the tracking of an order, the OrderBookingComposite composite contains sensors to provide a method for implementing trackable fields on messages. For example, the CreditCardAuthorization service has a composite sensor that indicates if the credit card was authorized. In addition, the OrderProcessor BPEL process also uses sensors for various activities. For example, the Scope_AuthorizeCreditCard scope in the OrderProcessor BPEL process, which verifies that the customer has acceptable credit using the CreditCardAuthorizationService service, uses a sensor for tracking. When you monitor instances of a composite through Oracle Enterprise Manager Fusion Middleware Control, you can monitor the sensors for both the composite and the BPEL process.

In the remaining sections of this chapter, deploy and run the Fusion Order Demo. As a part of it running it, use Oracle Enterprise Manager Fusion Middleware Control to monitor orders processed by the OrderBookingComposite composite. When you monitor an order, you can also view the composite sensors and activity sensors.

3.5Deploying Fusion Order Demo

This section describes how to deploy the Fusion Order Demo applications in the partition.

3.5.2 (Optional) Task 2: Create a Connection to the Oracle BAM Server

If you configured an Oracle BAM Server during installation, create a connection to it.

To create a connection to an Oracle BAM Server:

From the Application Menu, select New.

In the New Gallery dialog, in the Categories tree, select General > Connections.

Select BAM Connection and click OK.

The BAM Connection Wizard displays.

Ensure that Application Resources is selected.

Provide a name for the connection.

Click Next.

Enter weblogic in the User Name field and the password for that administrator in the Password field.

Enter the connection information about the Oracle BAM Server host described in Table 3-4.

Table 3-4 Oracle BAM Server Connection Information

Field

Description

BAM Web Host

Enter the name of the host on which the Oracle BAM Report Server and web applications are installed. In most cases, the Oracle BAM web applications host, Oracle BAM Server host, and the Oracle WebLogic Server are the same.

BAM Server Host

Enter the name of the host on which the Oracle BAM Server is installed.

User Name

Enter the Oracle BAM Server user name. For example:

weblogic

Password

Enter the password for the user name.

HTTP Port

Enter the port number or accept the default value of 9001. This is the HTTP port for the Oracle BAM web applications host.

JNDI Port

Enter the port number or accept the default value of 9001. The JNDI port is for the Oracle BAM report cache, which is part of the Oracle BAM Server.

Use HTTPS

Select this checkbox to use secure HTTP (HTTPS) to connect to the Oracle BAM Server during design time. Otherwise, HTTP is used.

The root directory where you have Oracle JDeveloper 11g installed. For example:

C:/JDeveloper/11

jdbc.urlBase

The base JDBC URL for your database in the format jdbc:oracle:thin:@your_hostname. For example:

jdbc:oracle:thin:@localhost

jdbc.port

The port for your database. For example:

1521

jdbc.sid

The SID of your database. For example:

ORCL or XE

db.adminUser

The administrative user for your database. For example:

system

db.demoUser.tablespace

The tablespace name for the Fusion Order Demo users. For example:

USERS

From the JDeveloper main menu, choose File > Save All.

In the Application Navigator, under the Resources node, right-click build.xml and choose Run Ant Target > buildAll.

When prompted, enter the administrative-user password for your database.

The buildAll command then creates the FOD user and populates the tables in the FOD schema. In the Apache Ant - Log, a series of SQL scripts display, followed by:

buildAll:
BUILD SUCCESSFUL
Total time: nn minutes nn seconds

For more information on the demo schema and scripts, see the README.txt file in the MasterBuildScript project.

3.5.4 Task 4: Set the Configuration Property for the Store Front Module

You can deploy the Store Front module as a simple web application or as part of a SOA environment. There is a property defined in the service portion of the Store Front module that is used within one of its pages to determine whether the SubmitOrder button fires an event that launches a BPEL process. When using the Store Front module within a SOA environment, you must change the default value for this property.

To set the configuration property for the Store Front module:

Choose File > Open.

In the Open dialog, browse to DEMO_DOWNLOAD_HOME/StoreFrontModule and select StoreFrontModule.jws.

Click Open.

When prompted to migrate files to the 11.1.1.7.0 format, click Yes. When the migration is complete, click OK.

Figure 3-8 shows the Application Navigator after you open the file for the application workspace.

In the Edit Business Components Configuration dialog, select the Properties tab and thefod.application.issoaenabled property. This property specifies whether the application is being deployed to a SOA environment.

Change the value of the fod.application.issoaenabled property to true, and then click OK. Figure 3-10 provides details.

3.5.6 Task 6: Deploy the Store Front Module

To deploy the Store Front module, you first deploy services and then deploy the application itself.

During deployment, Oracle JDeveloper creates the .jar and .war files and then assembles the .ear file, as specified in the deployment profiles. After the file is assembled, Oracle JDeveloper deploys the .ear file and unpacks it in a directory on the application server. The directory that is used is dependent on the target environment.

To deploy the Store Front module:

Deploy the services used by the Store Front module to send orders to the OrderBookingComposite composite.

In the editor, modify the following properties shown in Table 3-6 for the Oracle BAM environment.

Table 3-6 Properties Required for Oracle BAM

Field

Description

enable.bam.sensors

true

Set to true to enable sensors for Oracle BAM.

seed.bam.do

true

Set to true to seed data objects, alerts, and reports for Oracle BAM.

After deployment is done, set this value back to false. If this parameter is set to true after initial deployment and you redeploy at a later time, then the data objects, alerts, and reports reseed. Therefore, after initial deployment, set this parameter to false.

bam.server.host

The DNS name or IP address of the Managed Server for Oracle BAM. For example:

soahost

bam.server.port

The port of the Managed Server for Oracle BAM. For example:

9001

bam.server.username

The Oracle WebLogic Server administrator. For example:

weblogic

bam.server.password

The password of the Oracle WebLogic Server administrator.

From the Oracle JDeveloper main menu, choose File > Save All. Keep the sca-build.properties tab open, so you can modify the seed.bam.do parameter to false after deployment.

In the editor, perform the following steps for the WebLogicFusionOrderDemo application:

The root directory in which you have Oracle JDeveloper 11g installed. For example:

C:\\Oracle\\Middleware\\jdeveloper\\

soa.only.deployment

false

You set this property to true if you are using the OrderSDOComposite composite to place orders. This guide assumes you are using the Store Front module to place orders. Therefore, you must modify this property to false.

admin.server.host

The DNS name or IP address of the Administration Server for Oracle SOA Suite for hosting applications. For example:

soahost

admin.server.port

The port of the Administration Server. For example:

8001

managed.server

The DNS name or IP address of the Managed Server for Oracle SOA Suite for hosting applications. For example:

soahost

managed.server.port

The port of the Managed Server for Oracle SOA Suite for hosting applications. For example:

8001

server.user

The Oracle WebLogic Server administrator. For example:

weblogic

server.password

The password of the Oracle WebLogic Server administrator. For example:

welcome1

server.targets

The name of the Managed Server. For example:

soa_server

soa.server.oracle.home

The location of where to store the deployment plans for the adapters. For example:

C:\\AS11gR1SOA

foreign.mds.type

The location of the Oracle Metadata Services (MDS) Repository.

Leave the value to db and supply values for the mds.db.userid, mds.db.password, and mds.db.url parameters to specify the location of the MDS Repository.

Set the value to leave the default value to jdev.

soa.partition.name

The partition in which to deploy the composites. For example:

soaFusionOrderDemo

From the main menu, choose File > Save All.

In the Application Navigator, under the Resources node, right-click build.xml and choose Run Ant Target and select the following ant targets in the specified sequential order shown in Table 3-8.

Go back to the sca-build.properties tab and modify the seed.bam.do parameter to false.

From the main menu, choose File > Save All.

3.6Running WebLogic Fusion Order Demo

You begin the ordering process in the store front user interface, where you submit an order.

When an order is submitted, the Oracle ADF Business Component writes the order to the database and raises a NewOrderSubmitted business event using the EDN. The OrderPendingEvent mediator subscribes to this event, and initiates the main BPEL process, OrderProcessor, to process the order.

After you submit an order, you use Oracle Enterprise Manager Fusion Middleware Control of the Oracle SOA Suite installation to monitor how the OrderProcessor BPEL process orchestrated the orders. If you submit an order for more than $2,000, you can monitor how it requires human approval.

The instructions for placing orders and monitoring them in detail with Fusion Middleware Control are available from Oracle Technology Network: