bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

DI Plug-In

Running the WebLogic Integration Sample Applications

The data integration software includes two sample applications designed to illustrate the integration of business process management (BPM) in WebLogic Integration. This section describes these samples and give you step-by-step instructions for running them. The following topics are discussed:

- Prerequisites

- Running the Servlet Sample

- Running the EJB Sample

Prerequisites

The instructions presented in this section are based on the assumption that you have a good working knowledge of WebLogic Integration, and that you understand how data integration and the WebLogic Integration process engine work. In addition, you should have successfully installed WebLogic Integration and run a sample workflow before you try to run the sample applications.

Running the Servlet Sample

This sample application implements a Web archive file (WLPI_sample.war) that installs a servlet. The servlet accepts requests for conversion of binary data to XML. It is accessed via a browser and responds by displaying the generated XML data. In addition, the application posts the data to the WebLogic Integration event topic in either XML or binary format. The data may then be used to start a workflow.

What Is Included in the Servlet Sample

The servlet sample application resides in the SAMPLES_HOME\integration\samples\di\wlpi directory of your WebLogic Integration installation where SAMPLES_HOME is the samples directory in your WebLogic Platform installation. The following table describes the files included in the Servlet sample application.

Table 3-1 Servlet Sample Application Files

Directory | File | Description
--- | --- | ---
\wlpi\source | WLPI_sample.java | Source code for the servlet used to display HTML files on the screen and to translate binary data to XML. This XML may be placed, optionally, on the JMS topic.
\wlpi | SampleData.mfl | Message Format Language description of the sample binary data file used to start the sample workflow.
\wlpi | SampleData.data | Sample data file used as input when the sample workflow is started.
\wlpi | DI_ServletSample.jar | Exported workflow used in the sample. This workflow is imported automatically when you configure the samples as described in Step 1. Start the Sample Application Launcher.
\wlpi | Makefile | Make file for building the sample source to a .jar file.
\wlpi | build.cmd | Command that builds the .jar file from source.
\wlpi\images | bealogo.jpg | BEA logo displayed on the HTML page rendered by the sample servlet.
\wlpi\WEB-INF | hello.html | HTML page used by the sample servlet to obtain input data from the user.
\wlpi\WEB-INF | web.xml | J2EE configuration file defining deployment information for the sample servlet.
\wlpi\WEB-INF | weblogic.xml | BEA configuration file defining WebLogic-specific information for the sample servlet.
wlpi\WEB-INF\lib | cos.jar | Utility libraries used in the execution of the sample code.
wlpi\WEB-INF\lib | HtmlScreen.jar | Utility libraries used in the execution of the sample code.
Under WebLogic Platform Home Directory |
samples\ integration\ config\samples\ applications | WLPI_sample.war | Web archive file containing all executable sample code and configuration files. This file is automatically deployed to the WebLogic Integration application directory upon installation.

How to Run the Servlet Sample

To run the servlet sample, complete the procedure in this section. For instructions about the tasks specific to WebLogic Server and BPM functions, see the BEA documentation at e-docs.bea.com.

Step 1. Start the Sample Application Launcher

For first-time users:

Start the sample application launcher by completing the procedure appropriate for your platform:

- Windows

1. Choose Start—>BEA WebLogic Platform 7.0—>WebLogic Integration 7.0—>Integration Samples—>Start Server and Launch Examples. All samples are configured all and the samples launcher is displayed. It takes several minutes to configure all samples. Figure 3-1 shows the Sample Application Launcher.

   Figure 3-1 Sample Application Launcher

2. Select Data Integration Servlet from the list of sample applications. Figure 3-2 shows the Data Integration Servlet Sample page.

   Figure 3-2 Data Integration Servlet Sample Page

- UNIX

1. Make sure your PATH environment variable includes the directory in which the Netscape executable (netscape) resides. If it is not included, the samples launcher page cannot be displayed.

2. Go to the WebLogic Integration home directory (the directory in which you installed WebLogic Integration). For example:

   >     cd /home/me/bea/weblogic700/integration

3. Run the setenv script to set the top-level WebLogic Integration environment variables:

   >     . setenv.sh

4. Run the RunSamples script. For example:

   >     cd /home/me/bea/weblogic700/samples/integration/samples/bin
   >     RunSamples

5. If the RunSamples script detects that the configuration section of the RunSamples script has been run before, the following prompt is displayed:

   >     The WebLogic Integration repository has already been created
   >     and populated, possibly from a previous run of this
   >     RunSamples script. Do you want to destroy all the current
   >     data in the repository and create and populate the
   >     WebLogic Integration repository, again?
   >     Y for Yes, N for No

   If you answer N to this question, the RunSamples script skips the steps for creating and populating the repository and runs only the step for booting the sample instance of the WebLogic Server.

   If you answer Y to this question, the RunSamples script recreates and repopulates the repository, and then it boots the sample instance of the WebLogic Server. When you answer Y the RunSamples script destroys all the data currently in the repository and loads an unaltered version of the sample data into the repository. Answer Y only when the current sample data has been altered or removed and you want a fresh or unaltered version of the sample data in the repository.

   Now the RunSamples script starts an instance of the WebLogic Server (as a background process) and the samples launcher page is displayed.

If you have already configured samples:

Start the server and display the Samples Launcher by completing the procedure appropriate for your platform:

- Windows

1. Choose Start—>BEA WebLogic Platform 7.0—>WebLogic Integration 7.0—>Integration Examples—>Start Server.

2. Choose Start—>BEA WebLogic Platform 7.0—>WebLogic Integration 7.0—>Integration Examples—>Launcher Examples.

3. Select the Data Integration Servlet Sample.

- UNIX

1. Go to the bin directory in the samples domain. For example, if you installed the product in the default location, enter the following:

   >     cd SAMPLES_HOME/integration/samples/bin

2. Start the server by entering:

   >     . ./startServer

3. When the following message is displayed, the startServer script has completed successfully:

   >     StartServer execution successful

4. Start a Web browser using the following URL:

   >     http://localhost:7001/index.html

   The Samples Launcher Web page is displayed.

Step 2. Configure the Mail Session

This step is optional if you have already configured your mail host. You may want to perform it anyway, to verify your configuration.

1. Click on WebLogic Server under Administration Consoles on the Samples Launcher. The WebLogic Server Administration Console is displayed.

2. From the navigation tree, choose Services—>Mail—>wlpiMailSession.

3. Enter the appropriate information to configure your mail host. Make sure that mail.host=mailserver. The following figure shows an example of the Configuration tab in the Mail Session window.

   Figure 3-3 Configuration Tab in the Mail Sessions Window

4. Select the Targets tab.

5. Move the name of your mail server name from the Available column to the Chosen column, as shown in the following figure.

   Figure 3-4 Server Tab in the Mail Sessions Window

6. Click Apply.

Step 3. Update the Sample XML Data and Send Message

1. In a text editor, open the file SAMPLES_HOME\integration\samples\di\wlpi\SampleData.data. Replace the text user@nowhere.com with a valid e-mail address that can be used by the workflow to deliver an e-mail message.

2. In the Input File field on the Sample Application Launcher page, navigate to the following data file:

   >     SAMPLES_HOME\integration\samples\di\wlpi\SampleData.data

   The file specified must reside on the local system, which is not necessarily the one on which the server is running. If the file is not on the local system, an error message is displayed.

3. Click Submit. A short e-mail message is sent to the address you supplied in the data file.

Running the EJB Sample

This sample simulates a dataflow from an HR system to a payroll system, initiated by the entry of payroll data. Employee data is obtained from a legacy payroll system in which binary data is used. The data is translated to XML so that a calculation to determine the employee's pay information can be performed. The result of the calculation is translated back to binary format and sent on to the payroll system.

What Is Included in the EJB Sample

The EJB sample application resides in the SAMPLES_HOME\integration\samples\di\ejb directory of your WebLogic Integration installation. The following table describes the files included in the EJB sample application.

Table 3-2 EJB Sample Application Files

Directory | File | Description
--- | --- | ---
\ejb | makefile | Make file for building the sample source to a .jar file.
WLXTExample.jar | Sample workflow exported from data integration.
HR.mfl | MFL file for binary data returned from the sample HR Bean.
Payroll.mfl | MFL file for binary data passed for the sample Payroll Bean.
Autopay.cmd | Windows NT command script for initiating the workflow from the command line.
Autopay.sh | UNIX shell script for initiating the workflow from a command line.
build.cmd | Builds wlxtejb.jar from source.
\ejb\source | Payroll.java | Sample EJBs representing the legacy payroll system.
PayrollHome.java
PayrollBean.java
HR.java | Sample EJBs representing the legacy HR system.
HRHome.java
HRBean.java
AutoPay.java | Program that places a preformatted message on the Event topic to start the sample workflow.
HexDump.java | Utility class used by the sample EJBs.
EmployeeRecord.java | Employee data class used by the sample HR EJB.
Under WebLogic Platform Home Directory |
samples\ integration\ samples\di\ ejb\lib | WLXTEJB.jar | Executables for the sample application.

How to Run the EJB Sample

To run the EJB sample, complete the steps described in the following sections.

Step 1. Import the Workflow Definition

1. Start the WebLogic Integration Studio. For information on starting and logging on to the Studio, see Using the Studio Interface in Using the WebLogic Integration Studio.

2. Choose Tools—>Import Package. The Import: Select File dialog box is displayed (Figure 3-5).

   Figure 3-5 Import: Select File Dialog Box

3. Click Browse, select the definition file called WLXTExample.jar, and click Open. Click Next, the Import: Select Components to Import dialog box is displayed (Figure 3-6).

   Figure 3-6 Import: Select Components to Import

4. Make sure that the Activate workflows after import check box is selected, and that all components are selected. Click Import. The Import: Review Import Summary dialog box is displayed (Figure 3-7).

   Figure 3-7 Import: Review Import Summary

5. Confirm that the correct components are listed. If they are not, click Back and select the components again. If the list of components is correct, click Close. You are now ready to open the template.

Step 2. Open the Template

1. In the navigation tree, expand the WLXT Example template imported in the previous step. Right-click the template definition 1-1-00-12:00-AM.

2. Select Open. The workflow created for this sample application is displayed (Figure 3-8).

   Figure 3-8 Workflow for WebLogic Integration Example

Step 3. Start the Workflow

You can start the workflow created in the sample in either of two ways:

- From the WebLogic Integration Worklist

- From the Command Line

Once you start the workflow, you can use the Studio to monitor the simulated flow of data between the HR system and the payroll system.

From the WebLogic Integration Worklist

To start the sample workflow from the WebLogic Integration Worklist:

1. Start the WebLogic Integration Worklist and choose Workflow—>Start a Workflow.

2. Select WLXT Example. Click OK.

   Figure 3-9 WLXT Example Worklist

3. Right-click the Enter Payroll Data task and select Execute. The Enter Payroll Data dialog box is displayed (Figure 3-10).

   Figure 3-10 Enter Payroll Data

4. Enter the payroll data and click OK. The task and the workflow are started.

   Note: For this example, only the numbers 1 through 4 are valid as employee numbers. You can enter any value, however, as the period ending date and the number of hours worked.

From the Command Line

To start the sample workflow from a command-line prompt:

1. In a text editor, open the script (Autopay.cmd on Windows NT systems or Autopay.sh on UNIX systems) and check the location of the WebLogic Integration process engine. By default, the location is localhost and the number of the port is 7001.

2. Change the location information to match the host and port for your system.

3. Set the environment variable WL_HOME to the pathname of the directory in which WebLogic Server is installed on your system. For example:

   >     set WL_HOME=c:\bea\weblogic700

4. Set the environment variable WLI_HOME to the pathname of the directory in which WebLogic Integration is installed on your system. For example:

   >     set WLI_HOME=c:\bea\weblogic700\integration

5. Run the command script for your system (Windows NT or UNIX), passing the same parameters shown in Figure 3-10. For example:

   >     Autopay 1 2000-11-30 60

   The workflow is started.

Step 4. Examine the Variable Values

To monitor the sample dataflow, complete the following procedure:

1. In the Studio, display the Workflow Instances dialog box. For information about monitoring workflows, see Monitoring Workflows in Using the WebLogic Integration Studio.

2. Right-click the desired workflow instance and, from the pop-up menu, select Variables. The Workflow Variables dialog box is displayed.

3. Examine each variable and verify that it is set to the values entered in Step 3. Start the Workflow.