Wednesday, 14 August 2013

Deploying a JDeveloper SOA Application to Oracle WebLogic Server 11g

 

In this tutorial, you use Oracle JDeveloper 11g to deploy a SOA Web application to Oracle WebLogic Server 11g.

Overview

Run by a fictitious company called Global Company, the Fusion Order Demo provides two main applications:
  • The storefront module (StoreFrontModule.jws): Provides a Web site where customers can browse and place orders for products; based on Oracle ADF Business Components and ADF Faces
  • The SOA composite module (WebLogicFusionOrderDemo.jws): Provides back-end processing for customer orders
In this tutorial, you deploy the StoreFrontModule application and the SOA composite applications in the WebLogic Fusion Order Demo to a SOA-enabled Oracle WebLogic Server 11g domain that consists of:
  • An Administration Server that hosts the Fusion MiddleWare Control console for performing administrative tasks
  • A managed SOA server, which is an instance of an Oracle WebLogic Server that is used to host deployed applications
You perform the following actions:
  • You use JDeveloper to create a deployable Java EE archive that contains your application and a few required deployment descriptors.
  • You use the JDeveloper deployment mechanism to deploy the StoreFrontModule application to WebLogic Server.
  • You use an Ant script to deploy the SOA composite applications to the same Oracle WebLogic domain.
  • You manage the application by using Oracle Enterprise Manager Fusion Middleware Control.
  • You then test the application by running it in a browser from the WebLogic Server instance, ensuring that both the front end and back end are functional.

Prerequisites

Before starting the tutorial, you should:
1.
Have access to or have installed Oracle JDeveloper (11.1.1.1.0) Studio Edition. You can download it from Oracle Technology Network:
http://www.oracle.com/technology/products/jdev/index.html
Ensure that you download and install 11g and that it is the Studio Edition, not the Java Edition. You can verify that you have the correct version installed by selecting Help > About from the JDeveloper menu.
In order to create and deploy SOA composite applications, as you do in this tutorial, you also need to install the JDeveloper SOA Suite extension. To install it:
  • Select Help > Check for Updates from the JDeveloper menu to invoke the Check for Updates wizard.
  • In the wizard, search the Oracle Fusion Middleware Products update center.
Alternatively, you can download the SOA Suite extension for Oracle JDeveloper (file name soa­jdev­extension.zip ) from the Oracle Technology Network and import it into Oracle JDeveloper by browsing to the local downloaded file in the Check for Updates wizard.

2.
Have access to or have installed one of the following database versions:
  • Oracle XE Database 10g (10.2.01)
  • Oracle Database 10g (10.2.0.4+)
  • Oracle Database 11g (11.1.0.7+)
You can download it from Oracle Technology Network: http://www.oracle.com/technology/software/products/database/index.html

3. Have configured the SOA schema in your database, as described in the section entitled "Create Schemas for Oracle SOA Suite and Oracle BAM" in the Oracle® Fusion Middleware Installation Guide for Oracle SOA Suite 11g Release 1 (11.1.1).
 
4. Have updated the database parameters for the SOA infrastructure database (if using the XE database.) The processes parameter should be >= 200. To see what the value is, log into SQL*Plus as sysdba and then execute the following statements:
SQL> show parameter session
SQL> show parameter processes
If the processes parameter value is less than 200, execute the following statements:
SQL> alter system reset sessions scope=spfile sid='*';
SQL> alter system set processes=200 scope=spfile;
After this, shut down and restart the database, then issue the show statements in SQL*Plus again to ensure that they have taken effect.
5.
Have access to or have installed the Fusion Order Demo Sample Schema. Instructions for installing the FOD schema and creating a connection to it in JDeveloper are available on the Oracle Technology Network:
http://www.oracle.com/technology/products/jdev/samples/fod/index.html

6.
Have access to or have installed an instance of Oracle WebLogic Server 11g (10.3.1.0). You can download it from Oracle Technology Network:
http://www.oracle.com/technology/products/weblogic/index.html
You also must configure your WebLogic domain for ADF applications, as described in the section entitled "Creating and Extending WebLogic Server Domains" in the "Deploying Fusion Web Applications" chapter of the Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1). (See References.)
The WebLogic domain must be defined to be in development mode, not production mode.
7. Have access to or have installed SOA Suite. You can download it from Oracle Technology Network:
http://www.oracle.com/technology/tech/soa/index.html
Installation instructions are in the Oracle® Fusion Middleware Installation Guide for Oracle SOA Suite
11
g Release 1 (11.1.1). (See References.)
8. Have installed one of the following browsers:
  • Firefox 3 or higher
  • Internet Explorer 7 or higher
  • Safari 1.0 or higher
You may also wish to set the default browser for JDeveloper as follows:
  • Select Tools > Preferences from the menu
  • Select Web Browser and Proxy in the tree at the left
  • Browse to the location of your preferred browser's executable
9. Have a monitor that supports a screen resolution of 1024 X 768 or higher.

Starting the Environment


Starting the WebLogic Server
WebLogic Server can define multiple environments, called domains. Each domain contains on Administration Server and one or more Managed Servers.
When the target WebLogic Server domain is in development mode, JDeveloper automatically migrates application-level credentials, identities, and policies to the remote WebLogic Server. The integrated WebLogic Server that is part of JDeveloper is in development mode by default. You can use the Oracle WebLogic Server Administration Console to determine if a domain is in development or production mode.
If the WebLogic Server is in production mode, JDeveloper does not migrate security artifacts. Instead, administrators typically use Enterprise Manager or WLST scripts to deploy an application, including its security requirements, to a production-mode WebLogic Server. For more information about migrating application credentials and other jazn-data user credentials, see the Oracle Fusion Middleware Security Guide (see References.) Deploying to a production-mode WebLogic Server domain is outside the scope of this tutorial.
Assuming that you have installed WebLogic Server and SOA Suite with a development-mode domain named MySOADomain, perform the following steps to configure and start WebLogic Server:
1.
Prior to starting the WebLogic Server, you need to add a setting to the domain's configuration file that enables the credentials that are included in the FOD application to be deployed to the domain. This setting applies only to development instances as described above in the introduction to this section.
In a text editor, open the file <FMW_HOME>/user_projects/domains/MySOADomain/bin/setDomainEnv.cmd (substitute the name of your own SOA domain in this path,) and add the following to the SET JAVA_PROPERTIES line:
-Djps.app.credential.overwrite.allowed=true
Note: On Linux, open the <FMW_HOME>/user_projects/domains/MySOADomain/bin/setDomainEnv.sh file and set the following:
JAVA_PROPERTIES="-Djps.app.credential.overwrite.allowed=true -Dplatform.home=${WL_HOME} -Dwls.home=${WLS_HOME} -Dweblogic.home=${WLS_HOME} "
export JAVA_PROPERTIES
Save the file. If the WebLogic Server Administration Server is already running, you must restart it for this setting to take effect. If it is already running, stop the server as follows prior to completing the next step: From the Windows Start menu, select All Programs > Oracle WebLogic > User Projects > <MySOADomain> > Stop Admin Server, substituting the name of your own SOA domain.
Note: To shut down the Administration server on Linux, as the root user, change directories to <FMW_HOME>/user_projects/domains/<MYSOADomain>/bin and issue the following command:
./stopWeblogic.sh

2.
Start WebLogic Server. From the Window Start menu, select All Programs > Oracle WebLogic > User Projects > MySOADomain > Start Admin Server for Weblogic Server Domain, substituting the name of your own SOA domain.
Note: To start the server on Linux, as the root user, change directories to <FMW_HOME>/user_projects/domains/MYSOADomain/bin and issue the following command:
./startWebLogic.sh

3.
When prompted, enter your WebLogic user name and password. The password is not visible as you type.

4.
The Administration Server for your WebLogic domain is started when the command window displays the messages:
<Server state changed to RUNNING>
<Server started in RUNNING mode>

Leave the command window open, although you may minimize it if desired. The WebLogic Administration Server is now running and ready for use.

5. Start the SOA managed server if it is not already running (do this only if the Admin server is in RUNNING mode.) In a command window, enter the following command all on one line:
<WLS_HOME>\user_projects\domains\<Your_SOA_Domain>\bin\startManagedWebLogic.cmd <Managed_Server_Name> http://<host>:<port>
Substitute the following values:
For: Substitute:
<WLS_HOME> The path to your WebLogic Server installation, such as C:\weblogic
<Your_SOA_Domain> The domain name for your SOA managed server, such as MySOADomain
<Managed_Server_Name> The name of the managed server. For example:
soa_server1
<host> The DNS name or IP address of the server where WebLogic Server is installed, such as myhost.com
<port> The port of the Administration Server (typically 7001)
When the command window displays messages indicating that the server is running, you can minimize the window, but do not close it.

Note: To start the SOA managed server on Linux, as the root user, change directories to <FMW_HOME>/user_projects/domains/MYSOADomain/bin and issue the following command, substituting your own values for those listed in the table above:
./startManagedWebLogic.sh soa_server1 http://localhost:7001

Setting Environment Variables on WebLogic Server Host
There are two environment variables that JDeveloper must have set on the deployment platform for running the scripts that deploy the composite services. The Path variable must contain the path to the \bin subdirectory where Ant is installed. Also, JAVA_HOME must be set.
To set these variables on Windows, perform the following steps (for Linux, see note at the end of this section):
1. On the machine where the application is to be deployed, open Control Panel from the Windows Start menu and double-click the System icon.
2. In the System Properties dialog, select the Advanced tab and click Environment Variables.
3. In the Environment Variables dialog, locate the JAVA_HOME system variable and ensure that it is set to the location of the WebLogic 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 WebLogic JDK, such as C:\weblogic\jdk160_11.

Click OK to set the new system variable.
4. Double-click the Path system variable and ensure that it includes the path to the WebLogic ant\bin directory; if not, add it to the end of the variable value. For example, you may add something similar to the following:
;C:\weblogic\modules\org.apache.ant_1.7.0\bin

Click OK to set the Path variable, and then click OK twice more to dismiss the Environment Variables and the System Properties dialogs.
Note:
The above section pertains to Windows. On Linux, issue the following commands:
export JAVA_HOME=${FMW_HOME}/jdk160_11
export PATH=$PATH:<FMW_HOME>/modules/org.apache.ant_1.7.0/bin

Using Fusion Middleware Control to Examine the WebLogic Server Domain
Oracle WebLogic Server 11g comes with a browser-based Enterprise Manager (EM.) Through this EM interface, you can use Fusion Middleware Control to monitor activities and applications that are deployed to the WebLogic Server. After the WebLogic Administration Server is running, you can use a browser to connect to Fusion Middleware Control. The next few steps open this interface and briefly explore the WebLogic Server domain.
To use a browser to connect to Fusion Middleware Control, perform the following steps:
1.
Open a browser (see browser requirements in Prerequisites section of this tutorial) and enter the following URL: http://<host>:<enterprise_manager_port>/em

For example, if WebLogic Server is installed on your local machine with default ports, enter the URL:
http://localhost:7001/em

2.
Enterprise Manager prompts you for a user name and password. Enter the user name and administrator password for your WebLogic Server, and then click Login to enter Fusion Middleware Control.
 
3.
If prompted for your Accessibility Preference, select or deselect the appropriate check boxes and click Continue.
4.
A Farm is a group of Oracle WebLogic Server instances that share a metadata repository. When you log in to Fusion Middleware Control, the first page you see is the Farm home page.
The resizable and collapsible panel at the left of the window displays a navigation tree. You can use this navigation panel to return to the Farm home page at any time, or to navigate to other pages.

You can now examine applications, Web services, and other components of the WebLogic Server domain. When you have finished exploring, close the browser window.

Starting JDeveloper and Opening the FOD Applications
To start JDeveloper and prepare to work with the FOD applications, perform the following steps:
1.
Double-click the JDeveloper executable (jdeveloper.exe) found in the <jdev_home> directory.
If the Migrate User Settings dialog box opens, click NO.
Close the Tip of the Day window.

2.
Click the Application Navigator tab and from the Menu select File > Open. Alternatively, if no application is currently open, you can click the Open Application link.

3.
In the Open Application(s) window, navigate to the location where you extracted the FOD application files, such as <jdev_home>\jdeveloper\mywork\FOD. Open the StoreFrontModule folder, select the StoreFrontModule.jws file, and click Open.
If you are asked if you want to migrate files, click Yes, and then click OK in the Migration Status window to acknowledge that files were successfully migrated.
The application is now loaded into JDeveloper.

4.
In a similar fashion, open the CompositeServices > WebLogicFusionOrderDemo application, migrating the files if asked to do so.
If you see an error dialog, click OK. The steps in the section of this tutorial titled " Deploying the SOA Composite Applications to the WebLogic Server" will resolve the reported issue.

5.
The Application Navigator displays the most recently-opened application. Click the down arrow to the right of the application name and select StoreFrontModule from the drop-down list.
6. Set the application to use the FOD schema that you installed in your database (see Prerequisites.)
  • Access the Application Resources panel in the Application Navigator. If it is minimized, restore it. If not, click the accordion title to expand it.



  • Expand the Connections and Database nodes, and then right-click the FOD connection and choose Properties.

7. In the Edit Database Connection window, edit the Oracle (JDBC) Settings for your database.

For example, if you have an XE database installed on your local machine, set Host Name to localhost, JDBC Port to 1521, and SID to XE.
Click Test Connection. If successful, click OK. Otherwise, correct the problem and test the connection again.

Testing the Application

You can run and test an application within JDeveloper, using its integrated WebLogic Server, without the need to create application server connections or deploy the application. However, when you make the application available for users, you must deploy it to an external application server, as you do later in this tutorial.
To test the application in JDeveloper's WebLogic Server, perform the following steps:
1. In the Application Navigator, right-click StoreFrontService and select Rebuild from the context menu.

2. Right-click home.jspx in StoreFrontUI > Web Content and select Run from the context menu.
3. After compiling the project, JDeveloper starts WebLogic Server, displaying messages in the log window, and then deploys the StoreFrontModule application to it. Finally, it invokes the application in a browser.
The home page of the StoreFrontModule application displays in your default browser.

If you like, you may experiment with adding items to the shopping cart, displaying the shopping cart, and so on. Close the browser when you are finished.
Creating an Application Server Connection
Before you can deploy the StoreFrontModule application to your SOA WebLogic Server domain, you need to create a connection to it. To create an application server connection to your SOA domain, perform the following steps:
1.
If the Resource Palette is not showing (the default position is at the right of the JDeveloper IDE,) choose View > Resource Palette from the JDeveloper main menu.
Expand the IDE Connections panel in the Resource Palette and then expand Application Server.
You can see that there is, by default, a connection to JDeveloper's integrated WebLogic Server.
 
2.
Right-click Application Server in the IDE Connections panel and select New Application Server Connection from the context menu.

3. On the Name and Type page of the Create Application Server Connection wizard, enter a name for your connection, such as MySOAServer, and then click Next.

4. On the Authentication page of the wizard, enter the user name and password for your SOA WebLogic Server. Click Next.

5. On the Configuration page of the wizard, enter the following information, and then click Next to continue:
Weblogic Hostname The DNS name or IP address of the server where WebLogic Server is installed
Port The port of the Administration Server (the default is 7001.)
SSL port The port to use for secure SSL connections (the default is 7002.)
Always use SSL Leave the check box at its default value of not selected
WLS Domain The name of the WebLogic domain. For example:
MySOADomain
6. On the Test page of the wizard, click Test Connection. If the application server is available and the connection details are correct, the Status portion of the window displays a status of success for the eight tests that run.
If an error occurs, verify the connection settings, click Back to make any necessary changes, and then retest the connection.
If the connection is successful, click Finish to complete the connection.

You have just created a connection to the WebLogic Server to host the deployment of your application.

Preparing the Application for Deployment

Deployment profiles are project or application components that manage the deployment of an application. A deployment profile lists the source files, deployment descriptors (as needed,) and other auxiliary files to include in a deployment package. It describes the format, contents, type, and name of the archive file to be created, and it specifies dependencies, platform-specific instructions, and other information.
Oracle ADF applications are deployed as .ear (Enterprise ARchive) files that include a .war (Web ARchive) file for each view-controller project, a .jar (Java ARchive) file for each model project or for customization classes, and a MAR (Metadata ARchive) file for any seeded customizations or base metadata that you may need to place in the MDS repository. The .ear file is created for the entire application, whereas the other types of archive files are created on a per-project basis. For additional information on creating deployment profiles, see the section entitled "Creating a Deployment Profile" in the "Deploying Fusion Web Applications" chapter of the Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1). (See References.)
There are three main parts of the deployment package for the StoreFrontModule application: The StoreFrontService project (.jar files,) the StoreFrontUI project (.war file,) and the entire application (.ear file.) JDeveloper automatically creates default deployment profiles for the projects and the application, but developers can create their own custom profiles or edit the existing ones. The profiles for the FOD application and its projects have already been created, so now you simply examine these profiles. Do not make changes to the deployment profiles for this application.
In addition to examining deployment profiles, in this section of the tutorial you set a property on the StoreFrontModule application so that its pages can determine whether it is being run in a SOA environment. You perform the following:


Examining the Deployment Profile for the StoreFrontService Project
The first deployment profile you examine is for the StoreFront Service project. The contents of this project are primarily the Java classes that make up the data model portion of the application. This project's deployment profile uses a Business Components Service Interface archive type, which creates two types of JAR (Java ARchive) files: an EJB JAR file and a simple JAR file.
To examine the service interface deployment profile, perform the following steps:

1. With the StoreFrontModule application open in the Application Navigator, right-click the StoreFrontService project and select Project Properties from the context menu, or simply double-click the project.
2. In the Project Properties dialog, select Deployment in the tree in the left panel, and then expand SDOServices (Business Components Service Interface) in the Deployment Profiles list. Select the Common (JAR File) profile and click Edit.
3. In the Edit JAR Deployment Profile Properties dialog, select JAR Options in the tree in the left panel. In the JAR Options panel, make note of the location of the JAR file. This is the location where JDeveloper creates the JAR file when this deployment profile is used to deploy the application.
4. In the tree at the left, expand File Groups > Project Output and select Contributors. The selected options determine the files that the Filters panel displays.


5. Select Filters in the tree at the left. In the Filters panel, click Expand All Nodes. You can then scroll to see all the files that are selected to be included in the deployed JAR file.
6. Select the Patterns tab. This shows filter patterns, which are inclusion and exclusion rules that represent the same selection set. Selections made in the Files tab cause patterns to be added or removed on the Patterns tab, and changes made to the patterns cause files or directories on the Files tab to be selected or deselected.

Click Cancel to dismiss the Edit JAR Deployment Profile Properties dialog.
7. In the Project Properties dialog, select MiddleTier (EJB JAR File) and click Edit, then examine the selected options and properties as you did with the common JAR file. One difference between these two is that the EJB JAR deployment profile also includes an EAR file.

When you are finished, click Cancel twice to dismiss both dialogs.

Examining the Deployment Profile for the StoreFrontUI Project

The second deployment profile you examine is for the StoreFrontUI project. This project contains the user interface components of the application. The deployment file for this project is a .war file (Web ARchive, for the Web components.)
To examine the user interface deployment profile, perform the following steps:

1. In the Application Navigator, right-click StoreFrontUI project and select Project Properties from the context menu, or simply double-click the project.
2. In the Project Properties dialog, select Deployment in the tree in the left panel, and then select StoreFrontWebApp (WAR File) and click Edit.

3. In the Edit WAR Deployment Profile Properties dialog, select General in the tree at the left and look at the WAR File property, which shows where the .war file is created when this deployment profile is used to deploy the application.
Also notice the settings for the Web Application's Context Root. This is the name of the deployed application, which becomes part of the URL that is used to access the deployed application. Here it is set to the option Use Project's Java EE Web Context Root.
The project's context root by default is a rather long name; the project's context root has been reset in the project properties, as you see shortly. An alternate way to reset the context root would be to select the other option and specify the context root in this dialog.
Examine the file groups as you did with the StoreFrontService project, and then click Cancel to dismiss the Edit WAR Deployment Profile Properties dialog.
 
4. Back in the Project Properties dialog, select the Java EE Application node in the tree at the left. This is where the project's Java EE Web Context Root has been changed from the default. It is a good idea when creating deployment profiles to shorten the default name as has been done here.
Click Cancel to dismiss the Project Properties dialog.

Examining the Deployment Profile for the StoreFront Application

After creating the .jar and .war files, the application is assembled into a deployable package. The assembly part of deployment consists of creating a deployment profile that includes any .jar and .war files needed for the application, along with other server configuration files that may be required.
In some cases you may also want to add a jazn-data.xml file, such as for testing or when the user population is small and it makes sense to deploy a pre-configured jazn-data.xml file for authentication and authorization. However, using OID or a third-party LDAP server that can be configured through Enterprise Manager (EM) is a better choice for production systems.
If there are any WebLogic-specific deployment files needed in an application, they should be added to either the model project (in the EJB case) or the Web application project. For the sake of having a portable .ear file, the recommendation is to do all the WebLogic-specific configurations in the EM console after deployment.
To examine the deployment profile that has already been created for the application, perform the following steps:

1. Click the down arrow to the far right of the Application Navigator to open the Application Menu, and select Application Properties.
2. In the Application Properties dialog, select the Deployment node in the tree at the left.
In the bottom portion of the Deployment panel, notice that the check box is selected to Auto Generate and Synchronize weblogic-jdbc.xml Descriptors During Deployment (this is the default.)
Selecting this option ensures that the deployed application runs correctly using application-level data sources. When this option is selected, during deployment JDeveloper does the following:
  • Generates a <connection>-jdbc.xml file (such as FOD-jdbc.xml) for each connection in the application resources and sets the password indirection attribute to true as follows:
         <jdbc-driver-params>
              <use-password-indirection>true</use-password-indirection>
         </jdbc-driver-params>

    Upon deployment, JDeveloper determines the JDBC connection password from the <connection>-jdbc.xml file and then uses an Mbean to populate the JDBC connection password.
  • Updates weblogic-application.xml to add each <connection>-jdbc.xml as a module. For example:
    <module>
        <name>FOD</name>
        <type>
    JDBC</type>
        <path>
    META-INF/FOD-jdbc.xml</path>
    </module>
  • In web.xml (if it exists,) adds a resource reference to each JDBC JNDI name. For example:
    <resource-ref>
        <description>
    FOD Connection</description>
        <res-ref-name>
    jdbc/FODDS</res-ref-name>
        <res-type>
    javax.sql.DataSource</res-type>
        <res-auth>
    Container</res-auth>
    </resource-ref>
If this option is not selected, only the update to web.xml is performed when the application runs. Then enables you to manually set up JDBC files in the application or to use a global data source on the server.
If you are deploying to an EAR file and then deploying that file on Oracle WebLogic Server, you must set up passwords for the data sources on the server, and the way they are set up depends on whether this option is selected or deselected.
3. Observe that the Security Deployment Options are all selected (the default.) This means that JDeveloper:
  • Deploys the application security policies from the jazn-data.xml file, overwriting the domain-level policy store on the WebLogic Server
  • Deploys the application cwallet.sso file, overwriting the system credentials
  • Migrates the identity store portion of the jazn-data.xml file to the domain-level identity store on the WebLogic Server.

4. In the top portion of the Deployment panel, notice that three deployment profiles are defined:
  • metadata1 (MAR File): This Metadata Archive (MAR) profile is used to package seeded customizations or base metadata in the Oracle Metadata Services (MDS) repository.
  • StoreFrontModule (EAR File): This Java EE Enterprise Archive (EAR) profile provides you with centralized control over application assembly, enabling you to select which already-configured Java EE deployment profiles to include. You can mix and match any combination of configured WAR, EJB JAR, and/or client JAR profiles in projects within the same application.
  • StoreFrontService_SDOServices(EAR File): This EAR profile was created as part of the deployment profile for the StoreFront Service project (see step 7 above under Examining the Deployment Profile for the StoreFrontService Project.)

You can examine each of these deployment profiles as you did the project-level ones. When you do so, you can observe that the application-level EAR deployment profile includes only files from the StoreFrontUI project; the StoreFrontService project is not selected. This is because the EJB EAR file for the StoreFrontService project will be deployed separately.
When you have finished examining the profiles, you can dismiss all dialogs.


Setting Module Properties

The StoreFrontModule application can be deployed as a simple Web application or as part of a broader SOA environment. There is a property defined in the service portion of the StoreFrontModule application that is used within one of its pages to determine whether the Submit Order button fires an event that launches a BPEL process. When using the StoreFrontModule application within a SOA environment, you must change the default value for this property.
To enable SOA for the application, perform the following steps:

1. In the Application Navigator, expand StoreFrontService > Application Sources > oracle.fodemo.storefront > store > service. Right-click StoreServiceAM and select Configurations.
2. In the Manage Configurations dialog, select StoreServiceAMLocalWeb in the Names list, and then click Edit.
3. In the Edit Business Components Configuration dialog, select the Properties tab and the fod.application.issoaenabled property.
The developer of the application added this property to the configuration to provide a way to determine whether the application is being deployed to a SOA environment.
4. Change the value of the fod.application.issoaenabled property to true, and then click OK.
5. Click OK to dismiss the Manage Configurations dialog.


Deploying and Managing the Application




Deploying the StoreFront Module Application to the WebLogic Server
As you discovered in the previous sections of this tutorial, the StoreFrontModule application has multiple deployment profiles. In this section of the tutorial, you use two of them to first deploy services and then to deploy the application itself.
JDeveloper provides a one-click option to deploy an application to an application server by right-clicking and selecting the deployment profile and the target application server. Alternatively, you could use JDeveloper to create the EAR file and then deploy it by using a mechanism of the application server, such as Fusion Middleware Control for Oracle WebLogic Server. However, in this tutorial you deploy from JDeveloper.
Note that if you have a cluster of managed servers, JDeveloper supports deploying applications only to the Oracle WebLogic Server cluster, not deploying to individual managed servers within a cluster. You may be able to target one or more managed servers within a cluster by using Oracle WebLogic Server Administration Console or other Oracle WebLogic tools, but this may negatively affect the cluster. For more information about deploying to Oracle WebLogic Server clusters, see the Oracle Fusion Middleware Administrator's Guide (see References.)
To deploy the application, perform the following steps:

1. First you deploy the services that are used by the StoreFront application to send orders to the order booking composite application.
Click the down arrow to the far right of the Application Navigator to open the Application Menu, and select Deploy > StoreFrontService_SDOServices > to > <MySOAServer> (the menu shows your application server connection name instead of <MySOAServer>.)


2. In the Select Deployment Targets dialog, select the managed server (not the Admin server) and click OK.

3. There is a delay while the application builds. Open the log window if not already opened (View > Log ) to see the progress.

Then, in the Deployment Configuration dialog, click Deploy to accept the default values and begin the deployment.

4. The log should show that deployment was successful.
5. Next you deploy the StoreFrontModule. From the Application Menu, select Deploy > StoreFrontModule > to <MySOAServer> (the menu shows your application server connection name instead of <MySOAServer>.)

In the dialogs that appear during deployment, make the same selections as you did when deploying the services.
 
6. Check the log to see that the deployment was successful.
Note: During deployment, JDeveloper creates the .jar and .war files and then assembles the .ear file, as specified in the deployment profiles. After the file is assembled, 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.


Deploying the SOA Composite Applications to the WebLogic Server

The WebLogicFusionOrderDemo application is made up of several projects that provide composite services for the StorefrontModule application. Deployment of a composite extracts and activates the composite application in the SOA Infrastructure.
You can deploy SOA composite applications to Oracle WebLogic Server by first creating the .jar and .ear files in JDeveloper and then using the Deploy SOA Composite wizard in Fusion Middleware Control. However, in this tutorial you employ a different approach: you deploy the SOA composites by using an Ant script that has previously been created.
The Java-based Ant tool is a programmatic approach for building and deploying Java EE applications. Oracle JDeveloper supports creating and running Ant tasks. You can add or create Ant buildfiles for projects, and you can edit them with JDeveloper's XML Source Editor. For further information about Ant, see http://ant.apache.org.
In this section of the tutorial, you invoke Ant from the user interface to run targets that have already been defined in an Ant buildfile. Please note that prior to this deployment, you should have already performed the following tasks, as previously described:
  • Set environment variables on the WebLogic Server host
  • Installed SOA extensions for JDeveloper (see step 3 of Prerequisites)
Prior to running the script, you set some properties that are used by the buildfile, and then you run Ant targets to deploy the application. To do so, perform the following steps:

1. In the Application Navigator, click the down arrow next to the StoreFrontModule application name to invoke the Applications drop-down list.
Select WebLogicFusionOrderDemo to navigate to that application. (If it is not listed, open the application as described in step 4 of Start JDeveloper and Open the FOD Application.)
2. The Ant build artifacts are located in the bin project.
Expand bin > Application Sources. Right-click build.properties and select Open from the context menu, or simply double-click the file to open it.
(Note: There is also a link to that file under the Resources node and you could choose to open it from there instead.)
3. In the editor for build.properties, modify the following properties for your environment:
Parameter Value
oracle.home The root directory where you have Oracle JDeveloper 11g installed. For example:
C:\\Oracle\\Middleware\\jdeveloper\\
soa.only.deployment Set this property to false because you are using the StoreFrontModule application to place orders, and therefore are using its ADF-backed services.
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 (the default is 7001.)
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 (the default is 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_server1
soa.server.oracle.home The location of where on the JDeveloper machine to store the deployment plans for the adapters. For example:
C:\\AS11gR1SOA
foreign.mds.type The location of the MDS Repository.
Leave the value set to the default value of jdev when you are deploying from JDeveloper. In this case, you do not have to specify the values for the following parameters: jdbc-userid , jdbc-password, and jdbc.url. These parameters are ignored when the value is set to jdev.
(If you deploy from a server location without Oracle JDeveloper, then you need to set foreign.mds.type to db and supply values for the jdbc-userid , jdbc-password , and jdbc.url parameters to specify the location of the MDS Repository.)

4. Select File > Save All to save the file.
5. Now that you have set the buildfile properties, you an Ant script (target.) Right-click build.xml (in either the Application Sources or the Resources node) and select Run Ant Target, and then select to run server-setup-seed-deploy-test.

This target calls all of the following targets (alternatively, you could call each individually in sequence instead of server-setup-seed-deploy-test):
  1. compile-deploy-all (compiles, builds, and deploys all the SOA composites to the managed server for Oracle SOA Suite)
  2. seedFodJmsResources (populates the JMS resources for the Fulfillment mediator)
  3. seedDemoUsers (creates several users, including the user jstein, who is authorized to approve orders over $2,000)


Testing the Services Deployment

It is sometimes helpful to test a service separately from the BPEL process that calls it. This is especially useful when encountering problems and trying to isolate where they occur.
In this application, when a customer places an order that is greater than $2000, the application invokes a BPEL process to approve the application. This BPEL process calls several services, including a service to obtain order information. In this step, you test this service apart from the BPEL process to ensure that it has been deployed properly and is functional.

1. Open a browser window and enter the following URL to open the test harness for the service interface:
http://<host>:<port>/StoreFrontServiceHooks/StoreFrontService
where <host> is the DNS name or IP address of the server where WebLogic Server is installed and <port> is the port for the managed server (typically 8001.)
2. The StoreFrontService endpoint page contains a list of operations that are available as services. You can test any of these operations by entering the appropriate parameters. To test the simplest service, which obtains order information, select getOrderInfoVOSDO from the Operation drop-down list.


3. The getOrderInfoVOSDO operation takes only one parameter. Enter the ID of any existing order, such as 1047, and click Invoke.
4. If the service is deployed and functioning correctly, the Test Result page returns information about the specified order in XML format.
You can leave the browser window open for the next section.


Managing the Application

1. Open a browser window and enter the following URL to open Fusion Middleware Control:
http://<host>:<port>/em
where <host> is the DNS name or IP address of the server where WebLogic Server is installed and <port> is the port for the Admin server (typically 7001.)
Log in using your WebLogic credentials and click Login.
2. On the Home page for the farm, you can see application deployments and deployments for SOA composites. You should see your deployments listed among other applications and composites that have been deployed to that server. Next to each deployment is a green upward arrow to show that it is running.

Click the StorefrontModule link.
3. The StorefrontModule application's home page displays information about the deployed application. After examining this information, click Application Deployment to invoke the menu.
4. The Application Deployment menu enables you to control the application by invoking menu choices. For example, you can start, stop, undeploy, redeploy, or view logs for the application, Select Logs > View Log Messages.
5. On the Log Messages page, enter different query criteria and click Search to view pertinent log messages.


6. From the Application Deployment menu, select WebLogic Server Administration Console. (You could also access this console by clicking its link on the application's home page, or by directly entering its URL: http://<host>:<port>/console.)
If this is the first time you have accessed the console, you see a message indicating that the console application is being deployed.
7. When the Administration Console appears, enter the WebLogic credentials as you did previously and click Log In.
8. The WebLogic Administration Console displays configuration settings for the StoreFrontModule application. You can select the various tabs to view the settings. For example, the Configuration tab enables you to set a session timeout. These settings enable you to finely control an application.

When you are done exploring the Administration Console, you can leave the browser window open for the next section.


Running the Application

Now that you've deployed the application, you can run it on the application server by using a browser so that you can test that the services are functioning correctly.
The ordering process begins in the StoreFront user interface, where a customer shops for and orders products. When the customer submits an order, the Application Development Framework Business Component writes the order to the database. Orders totaling more than $2000 require human approval. If the order is greater than $2000, submitting the order raises a business event when the application module property issoaenabled is set to true (see Setting Module Properties.) The OrderPendingEvent mediator, which subscribes to this event, initiates the OrderProcessor BPEL process to process the order. This is part of the OrderBookingComposite application.
To test this functionality, perform the following steps:

Placing Orders

1. Open a Browser window and enter the following URL, which contains the context-root StoreFrontModule that you specified earlier:
http://<host>:<port>/StoreFrontModule/faces/home
Substitute your host name for <host>, and for <port> substitute the port of the managed server to which you deployed the StoreFrontModule application (typically 8001.)

In the above URL, StoreFrontModule is the context-root of the application, faces is a mapping to the Faces Servlet, and home is the view id of the task flow view activity that corresponds to the home.jspx page.
 
2. First you place an order for less than $2000. Select the Ipod Nano 1 Gb and click Add, and then select the Ipod Nano 4Gb and click Add. The Shopping Cart Summary shows that the order subtotal is $399.90.

3. Click the Checkout link, located in the middle of the menu bar.
4. A login dialog appears. For purposes of the demo, the valid users for the different application roles are shown. Enter the user name ngreenbe, with welcome1 as the password, and click Log In.
5. On the Shipping Details page, make note of the following values:
  1. Order ID in the Order Information section
  2. Shipping Address in the Shipping Information section
  3. Payment Option Code in the Payment Options section
6. In the Order Summary section at the right of the page, make note of the order total and click Submit Order.
7. On the Invoice Details page, click Exit and Continue Shopping (on the menu bar.)

The application returns to the home page.
8. Place another order by adding items until the Shopping Cart Summary displays an order subtotal that is greater than $2,000.

 
9. Click Checkout.
10. On the Shipping Details page:
  • Make note of the Order Id.
  • Modify any of the options in the Shipping Information section, making note of the values.
  • Make note of the Payment Option Code in the Payment Options section.
11. Make note of the order total, which should be greater than $2,000, and click Submit Order.
12. On the Invoice Details page, click Logout.

A message appears indicating that you are logged out.


Monitoring and Approving Orders

You now use Fusion Middleware Control to monitor the orders that were sent from the StoreFront module to the OrderBookingComposite composite, and you use the BPM Worklist application to complete a process that requires human approval (the order that is greater than $2000.)

1. Open a browser window and enter the following URL to open Fusion Middleware Control:
http://<host>:<port>/em
where <host> is the DNS name or IP address of the server where WebLogic Server is installed and <port> is the port for the Admin server (typically 7001.)
Log in using your WebLogic credentials and click Login.


2. In the Deployments section of the Farm home page, expand SOA and soa-infra, and then click the OrderBookingComposite link.
3. The OrderBookingComposite page shows instances where this composite application has been invoked, along with the state of the instance and error messages for any faults that may have occurred. The last two transactions should be the orders that you just placed as the user ngreenbe.
Click the second most recent link.

Note: If you do not see any instances, ensure that you have set the issoaenabled property prior to deploying the StoreFrontModule application, as described in Setting Module Properties.
4. A separate window opens to display the flow trace for the selected instance of OrderBookingComposite. It shows faults if any have been encountered, and also shows the components of the composite. You should see that all steps in the process have completed successfully.
Click the OrderProcessor link for the BPEL component.


5. On the OrderProcessor instance page, you see a list and description of all the orchestrated processes that make up order processing. Click the Flow tab.


6. The Flow tab shows a visual depiction of the process in the form of a BPEL diagram. You can click any of the activities to get more detail about it.

When you have finished examining the OrderProcessor BPEL process, close the separate browser window.
7. Back on the OrderBookingComposite page, on the Dashboard tab, click the most recent instance, which should be the order for more than $2000 that the user ngreenbe placed.


8. On the flow trace page you should see that all tasks that comprise the OrderPendingEvent have completed except for the ApprovalHumanTask, which is still running. This indicates that someone needs to approve the order before processing continues.
Click ApprovalHumanTask.


9. The Instance Detail of ApprovalHumanTask shows that the order that was created by Nancy Greenberg has been assigned to user jstein for approval.
Make note of the workflow ID, and then click the Go To Worklist Application link.

Note: Another way to invoke the worklist application is to enter the URL http://<host>:<port>/integration/worklistapp/faces/home.jspx in a browser, using the host and port for the managed server.
10. If the worklist shows you logged in as ngreenbe, click the Logout link.
Log in as the user jstein, with the password of welcome1.
11. The Inbox on the worklist shows all actions that have been assigned to jstein. The Number column displays the workflow IDs.
Click the row for the workflow item whose ID you made note of previously.
12. Select Approve from the Actions menu.


13. Click OK to acknowledge the message that the request was successful. The task is removed from the task list.

Close the separate browser window.
14. Return to Fusion Middleware Control and select the link for the same instance of OrderBookingComposite. The Trace section of the flow trace page should now show that all steps are completed.

When you are finished examining the flow trace, you can close the browser window.


In this tutorial, you used Oracle JDeveloper 11g to deploy a SOA Web application to Oracle WebLogic Server 11g. You started the WebLogic Server and created a JDeveloper connection to it. You examined the deployment profiles for the application, and then you deployed the application to the WebLogic Server. You used Fusion Middleware Control to review the administration details of the application. Finally, you tested the application by running it from the application server in a browser.
In this tutorial, you learned how to:
Start the environment
Test the application in the JDeveloper integrated WebLogic Server
Create a connection to the application server
Prepare the application for deployment
Deploy the application and manage the application server
Run the application

No comments:

Post a Comment

Note: only a member of this blog may post a comment.