BEA Logo BEA WebLogic XML/Non-XML Translator Release 1.0.1

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

 

   WebLogic XML/Non-XML Translator Doc Home   |   WebLogic XML/Non-XML Translator Samples Guide   |   Previous Topic   |   Next Topic   |   Contents   |  

Running the WebLogic Process Integrator Sample Applications

 

The BEA WebLogic XML/Non-XML Translator software includes two sample applications designed to illustrate the integration of XML Translator with BEA WebLogic Process Integrator. This section describes these samples and gives you step-by-step instructions for running the samples. The following topics are discussed:

 


Prerequisite Considerations

There are certain software applications that must be installed and tasks that must be performed prior to running the Purchase Order sample. Please refer to the BEA WebLogic XML/Non-XML Translator Release Notes for more information.

Note: The instructions presented in this section assume that you have a good working knowledge of BEA WebLogic Process Integrator and BEA WebLogic Server. You should have successfully installed WebLogic Process Integrator and run a sample workflow prior to running the Purchase Order sample.

 


Running the WebLogic Process Integrator Servlet Sample

This sample application implements a Web Archive (WLPI_Sample.war) that installs a servlet to accept requests for conversion of binary data to XML. The servlet is accessed via a browser and responds by displaying the generated XML data. In addition, a generated XML file may be posted to a JMS topic to act as a starting event for a WebLogic Process Integrator workflow.

Note: This sample does not require the interface to WebLogic Process Integrator; however, in order to start the workflow, WebLogic Process Integrator is required.

What is Included in the Servlet Sample

The following table provides a listing and description of the files included in the WebLogic Process Integrator Servlet sample application. This sample application can be found in the samples\wpli\servlet directory.

Table 2-1 List of Servlet Sample Application Files

Directory

File

Description

\servlet\source

WLPI_sample.java

The source code for the servlet used to present the HTML screen and process binary data to XML. This XML may be placed, optionally, onto the WebLogic Process Integrator JMS topic.

\servlet

SampleData.mfl

The Message Format Language description of the sample binary data file used to start the sample WebLogic Process Integrator workflow.

\servlet

SampleData.data

The sample data file used as input to start the sample WebLogic Process Integrator workflow.

\servlet

SampleWorkflow.xml

The exported WebLogic Process Integrator workflow used in the sample. This workflow should be imported via the WebLogic Process Integrator Studio GUI to setup the workflow tasks involved in the sample.

\servlet

WLPI_sample.war

A Web Archive file containing all executable sample code and configuration files.

\servlet\images

bealogo.jpg

The BEA logo image displayed on the HTML page rendered by the sample servlet.

\servlet\WEB-INF

hello.html

The HTML page used by the sample servlet to obtain input data from the user.

\servlet\WEB-INF

web.xml

The J2EE configuration file defining deployment information for the sample servlet.

\servlet\WEB-INF

weblogic.xml

The BEA configuration file defining WebLogic-specific information for the sample servlet.

\servlet\WEB-INF\lib

*.jar

Utility libraries, including XML Translator, that are used in the execution of the sample code.

How to Run the Servlet Sample

This section describes the steps required to run the Servlet Sample. Follow the instructions appropriate for your WebLogic Server version (5.1 or 6.0). For instructions on the tasks specific to WebLogic Server and WebLogic Process Integrator, refer to the documentation that accompanies those applications.

Using WebLogic 5.1

To run the servlet sample stand-alone (without WebLogic Process Integrator):

  1. Copy the license-group section from the XML Translator license file (license.bea) to the WebLogic Process Integrator license file. For details on this procedure, refer to the BEA WebLogic XML/Non-XML Translator Release Notes and the WebLogic Process Integrator documentation.

  2. Using a text editor, add the following line to the end of your weblogic.properties file:

    weblogic.httpd.webApp.WLXT=<path to war file>/WLPI_sample.war

    Note: If you have both WebLogic Server and WebLogic Process Integrator installed, you may have two instances of the weblogic.properties file. Make sure you edit the file in the WebLogic Process Integrator directory for this sample exercise.

  3. Start WebLogic.

  4. Start a web browser and enter the following URL:

    http://<weblogic server>:<weblogic port>/WLXT/WLXTTest

  5. Select an MFL file and a data file from your local machine.

  6. Click Submit. The server response displays the generated XML data.

The following additional steps can be run to start the workflow if you are integrating with WebLogic Process Integrator:

  1. Using a text editor, open the weblogic.properties file in the wlpi\Server directory.

  2. Modify the mail.host parameter to contain the address of your SMTP server.

  3. Start WebLogic Process Integrator.

  4. Start the WebLogic Process Integrator Studio and log on.

  5. Select Templates in the left pane, click the right mouse button, and choose Create to create a new template.

  6. Select the newly created template, click the right mouse button, and choose Import Template Definition.

  7. Select the file \samples\wlpi\SampleWorkFlow.xml.

  8. Select the newly imported workflow, click the right mouse button, and choose Properties. The Properties dialog displays.

  9. Select Active and click OK.

  10. Select the workflow, click the right mouse button, and choose Save.

  11. Using a text editor, open the file \samples\wlpi\SampleData.data. Replace the text user@bea.com with a valid email address. This is the address the workflow uses to deliver the email message.

  12. Open a browser and go to the following URL:

    http://<weblogic server/port>/WLXT/WLXTTest

  13. Enter the following path to the MFL file:

    samples\wlpi\SampleData.xml

  14. Enter the following path to the data file:

    samples\wlpi\SampleData.data

  15. Select the option to invoke WebLogic Process Integrator and click Submit. A short email message is sent to the address you supplied in the data file.

Using WebLogic 6.0

To run the servlet sample stand-alone (without WebLogic Process Integrator):

  1. Copy the license-group section from the XML Translator license file (license.bea) to the WebLogic Process Integrator license file. For details on this procedure, refer to the BEA WebLogic XML/Non-XML Translator Release Notes and the WebLogic Process Integrator documentation.

  2. Start WebLogic.

  3. Copy the WLPI_sample.war file to the default web application directory. By default, these directories are:

    C:\bea\wlserver6.0\config\mydomain\applications (for Windows NT or Windows 2000)

    $BEA_HOME/wlserver6.0/config/mydomain/applications (for Unix)

  4. If your WebLogic Server has auto-deployment enabled, the sample web application is deployed within several seconds. Verify the deployment setting using the WebLogic Server Console, as shown in Figure 2-1.

    Figure 2-1 WebLogic Server Console

  5. If you have disabled auto-deployment on your WebLogic Server, you must statically deploy the web application using the WebLogic Server Console. To do this, follow the steps below:

    1. From the tree in the left pane, choose Web Applications.

    2. In the right pane, click Install a New Web Appolication.

    3. Enter the path and file name of the WLPI_sample.war file and press Upload.

      Note: Do not select the file you copied to the applications directory in step 3.

      After the WLPI_sample.war file is successfully uploaded, WLPI_sample appears in the tree under Web Applications.

    4. Select the new WLPI_sample node from the tree.

    5. Click the Deployed checkbox in the right pane and click Apply.

    6. Select the Targets tab.

    7. Move your server name from the Available column to the Chosen column, as shown in Figure 2-2.

      Figure 2-2 WebLogic Server Console Targets Tab

  6. Start a web browser and enter the following URL:

    http://<host>:<port>/WLPI_sample/WLXTTest

  7. Select an MFL file and a data file from your local machine.

  8. Click Submit. The server response displays the generated XML data.

The following additional steps can be run to start the workflow if you are integrating with WebLogic Process Integrator:

  1. Start WebLogic Process Integrator.

  2. Start the WebLogic Process Integrator Studio and log on.

  3. From the tree in the left pane, choose Mail.

  4. Enter the appropriate information to configure your mail host. Figure 2-3 shows an example of the Mail Session Configuration screen.

    Figure 2-3 WebLogic Server Console Mail Session Configuration Tab

  5. Select the Targets tab.

  6. Move your mail server name from the Available column to the Chosen column, as shown in Figure 2-4.

    Figure 2-4 WebLogic Server Console Mail Session Targets Tab

  7. Select Templates in the left pane, click the right mouse button, and choose Create to create a new template.

  8. Select the newly created template, click the right mouse button, and choose Import Template Definition.

  9. Select the file \samples\wlpi\SampleWorkFlow.xml.

  10. Select the newly imported workflow, click the right mouse button, and choose Properties. The Properties dialog displays.

  11. Select Active and click OK.

  12. Select the workflow, click the right mouse button, and choose Save.

  13. Using a text editor, open the file \samples\wlpi\SampleData.data. Replace the text user@bea.com with a valid email address. This is the address the workflow uses to deliver the email message.

  14. Open a browser and go to the following URL:

    http://<weblogic server/port>/WLXT/WLXTTest

  15. Enter the following path to the MFL file:

    samples\wlpi\SampleData.xml

  16. Enter the following path to the data file:

    samples\wlpi\SampleData.data

  17. Select the option to invoke WebLogic Process Integrator and click Submit. A short email message is sent to the address you supplied in the data file.

 


Running the WebLogic Process Integrator EJB Sample

This sample simulates a dataflow from an HR system to a payroll system, initiated by the entry of payroll data. The employee data is obtained from a legacy payroll system that uses binary data. The data is translated to XML in order to perform a calculation to determine the employee's pay information. The result of the calculation is translated back to binary and sent on to the payroll system.

What is Included in the EJB Sample

The following table provides a listing and description of the files included in the WebLogic Process Integrator EJB sample application. This sample application can be found in the samples\wpli\ejb directory.

Table 2-2 List of EJB Sample Application Files

Directory

File

Description

\ejb

Makefile

Make file for building the sample source to a .jar file.

\ejb

WLXTExample.xml

Exported sample workflow from WebLogic Process Integrator.

\ejb

HR.mfl

MFL file for binary data returned from the Sample HR Bean.

\ejb

Payroll.mfl

MFL file for binary data passed to the Sample Payroll Bean.

\ejb

Autopay.cmd

Windows NT command script to initiate the workflow from the command line.

\ejb

Autopay.sh

Unix shell script to initiate the workflow from a command prompt.

\ejb\lib

WLXTEJB51.jar or
WLXTEJB60.jar

Executables for the sample application. The file WLXTEJB51.jar is used if you have WebLogic Server version 5.1 installed. The file WLXTEJB60.jar is used if you have WebLogic Server 6.0 installed.

\ejb\source

XMLnonXML Translator.java

EJB wrapper class for WLXT.

\ejb\source

XMLnonXML TranslatorHome.java

EJB wrapper class for WLXT.

\ejb\source

XMLnonXML TranslatorBean.java

EJB wrapper class for WLXT.

\ejb\source

Payroll.java

Sample EJB to represent legacy payroll system.

\ejb\source

PayrollHome.java

Sample EJB to represent legacy payroll system.

\ejb\source

PayrollBean.java

Sample EJB to represent legacy payroll system.

\ejb\source

HR.java

Sample EJB to represent legacy HR system.

\ejb\source

HRHome.java

Sample EJB to represent legacy HR system.

\ejb\source

HRBean.java

Sample EJB to represent legacy HR system.

\ejb\source

AutoPay.java

Program to place a pre-formatted message on the WLPI Event Topic to start the sample workflow.

\ejb\source

HexDump.java

Utility class used by the sample EJBs.

\ejb\source

EmployeeRecord.java

Employee data class used by the sample HR EJB.

How to Run the EJB Sample

Follow the steps below to run the EJB sample. For specific instructions on performing the tasks in WebLogic Process Integrator and WebLogic Server, please refer to the documentation that accompanies those applications.

Step 1. Configure and Run WebLogic Process Integrator using WebLogic Server 5.1

Note: If you are running WebLogic Process Integrator under WebLogic Server 5.1, follow the steps below.

If you are running WebLogic Process Integrator under WebLogic Server 6.0, proceed to Step 2. Configure and Run WebLogic Process Integrator using WebLogic Server 6.0.

  1. Copy the license-group section from the XML Translator license file (license.bea) to the WebLogic Process Integrator license file. For details on this procedure, refer to the BEA WebLogic XML/Non-XML Translator Release Notes and the WebLogic Process Integrator documentation.

  2. Deploy the sample beans by adding an entry to the WebLogic Properties file. For example:

    weblogic.ejb.deploy=d:/beahome/wlxt1.0/samples/ejb/lib/WLXTEJB51.jar

  3. Add the full path and file name of the following .jar files to the server.cmd file used to start the WebLogic Process Integrator Server.

    xmlx.jar
    dom2.jar
    sax2.jar
    ebase.jar
    wlxt.jar

  4. In the WebLogic Process Integrator home directory, create a subdirectory called mflrepos.

  5. Copy the two sample .mfl files included with this sample (Payroll.mfl and HR.mfl) to the new subdirectory.

  6. Start the WebLogic Process Integrator Server.

  7. Run WebLogic Process Integrator Studio.

Step 2. Configure and Run WebLogic Process Integrator using WebLogic Server 6.0

  1. Copy the license-group section from the XML Translator license file (license.bea) to the WebLogic Process Integrator license file. For details on this procedure, refer to the BEA WebLogic XML/Non-XML Translator Release Notes and the WebLogic Process Integrator documentation.

  2. Copy the file WLXTEJB60.jar from the \samples\wlpi\ejb\lib directory where you have XML Translator installed to the \lib directory where you have WebLogic Process Integrator installed.

  3. Open the file config.xml in a text editor. This file can be found in the directory <BEA_Home>\wlserver6.0\config\<domain_name>.

  4. Add the following lines to the end of the WebLogic Process Integrator Application section of the file:

    <EJBComponent
    Name="wlxt-sample"
    Targets="<your_machine_name>"
    URI="WLXTEJB60.jar"
    />

    Figure 2-5 shows an example of the Application section of the config.xml file with the above lines added.

    Figure 2-5 Sample config.xml file

  5. Add the full path and file name of the following .jar files to the server.cmd file used to start the WebLogic Process Integrator Server.

    xmlx.jar
    dom2.jar
    sax2.jar
    ebase.jar
    wlxt.jar

  6. In the WebLogic Domain home directory, create a subdirectory called mflrepos. By default, this directory is:

    $BEA_Home/wlserver60

  7. Copy the two sample .mfl files included with this sample (Payroll.mfl and HR.mfl) to the new subdirectory.

  8. Start the WebLogic Process Integrator Server.

  9. Run WebLogic Process Integrator Studio.

Step 2. Create the Business Operations for the Workflow

You need to create seven business operations for the sample. These business operations are referenced by the sample workflow; therefore, their names must exactly match the list below.

Notes: The names of these operations must exactly match the above list. Business operation names are case-sensitive.

To create the business operations:

  1. Choose Configure—>Business Operations and click Add.

  2. Enter the information for each business operation as shown in each of the seven dialog illustrations that follow.

  3. After you enter the information in the dialog, click OK.

  4. Repeat steps 1 through 3 for each business operation.

    Figure 2-6 Create XML/nonXML Translation Bean Business Operation

    Figure 2-7 Create Example HR Bean Business Operation

    Figure 2-8 Get Employee Info Business Operation

    Figure 2-9 Translate Binary to XML Business Operation

    Figure 2-10 Create Example Payroll Bean Business Operation

    Figure 2-11 Post Payroll Data Business Operation

    Figure 2-12 Translate XML to Binary Business Operation

    The following dialog shows a list of the completed business operations.

    Figure 2-13 List of Completed Business Operations

  5. Click Done when you have finished creating the Business Operations.

Step 3. Create the Template and Import the Template Definition

To create the template and import the template definition:

  1. Create a new template called WLXT Example.

  2. Select the template from the tree view in the left pane and click the right mouse button.

  3. Choose Import Template Definition.

  4. Select the definition file WLXTExample.xml. A message box opens informing you that the business operations you just created will be executed during this workflow.

    Figure 2-14 Import Message

  5. Click OK to close the message box. A confirmation message displays.

    Figure 2-15 Import Confirmation Message

  6. Click OK to close the message box.

Step 4. Open and Activate the Template

To open and activate the template:

  1. Select the WLXT Example template definition imported in the previous step from the tree view and click the right mouse button.

  2. Choose Open. The workflow created for this sample application displays.

    Figure 2-15 Workflow for WLXT Example

  3. Select the WLXTExample template definition again from the tree view and click the right mouse button.

  4. Choose Properties. The Template Definition properties dialog displays.

    Figure 2-16 Template Definition

  5. Click Active to activate the template and click OK.

  6. Select the WLXTExample template definition a third time from the tree view and click the right mouse button again.

  7. Choose Save to save the template definition with the changes you made.

Step 5. Start the Workflow

There are two ways to start the workflow created in the sample:

From the WebLogic Process Integrator Worklist

To start the sample workflow from the Weblogic Process Integrator Worklist:

  1. Start WebLogic Process Integrator Worklist and choose Workflow—>Start a Workflow.

  2. Select WLXT Example. The template opens and the tasks are displayed.

    Figure 2-17 WLXT Example Worklist

  3. Select the Enter Payroll Data task and click the right mouse button.

  4. Choose Execute. The Enter Payroll Data dialog displays.

    Figure 2-18 Enter Payroll Data

  5. Enter the payroll data and click OK. The task is started and the workflow runs.

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

From the Command Line

To start the sample workflow from a command line prompt:

  1. Open the script file (Autopay.cmd on Windows NT systems; Autopay.sh on Unix systems) in a text editor and check the location of the WebLogic Process Integrator Server. By default, the location is localhost and port:7001.

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

  3. Run the command scripts for your system (Windows NT or Unix), passing the same parameters shown in Figure 2-18. For example:

    Autopay 1 2000-11-30 60

Figure 2-19 shows the WebLogic Process Integrator output from executing the workflow.

Figure 2-19 WebLogic Process Integrator Server Console