BEA Logo BEA WebLogic Collaborate Release 1.0.1

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

 

   WebLogic Collaborate Doc Home   |   Getting Started   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Running the WebLogic Process Integrator Verifier Example

 

The WebLogic Process Integrator Verifier example application (wlpiverifier), uses WebLogic Process Integrator workflows to exchange business messages in the WebLogic Collaborate environment. This example application demonstrates how WebLogic Process Integrator workflows are integrated into the WebLogic Collaborate environment, and how data is passed between two WebLogic Process Integrator partner workflows (trading partners) in a conversation.

The following sections describe how to run the Verifier example, and how WebLogic Process Integrator workflows are integrated in the WebLogic Collaborate environment:

Note: An installation Verifier example is also provided with WebLogic Collaborate to verify that the product is correctly installed. Before running the WebLogic Process Integrator Verifier example, run the installation Verifier example to ensure that your WebLogic Collaborate environment is configured so that the procedures described in the following sections will work. For information on how to run the installation Verifier example, refer to the BEA WebLogic Collaborate Installation Guide.

 


Setting Up and Running the WebLogic Process Integrator Verifier Example

You can configure the WebLogic Process Integrator Verifier example to run on one or two instances of WebLogic Server. Execute it on two instances of WebLogic Server before attempting to run it on a single instance.

Running the Example on Two WebLogic Server Instances

The WebLogic Process Integrator Verifier example is in the following location:

Windows

%WLC_HOME%\examples\wlpiverifier

UNIX

$WLC_HOME/examples/wlpiverifier

This example is configured to run on two instances of WebLogic Server. In this example, you start the c-hub on one instance of WebLogic Server, and two c-enablers on the second instance.

Complete the following procedures to set up and run the Verifier example:

Step 1: Configuring WebLogic Collaborate for WebLogic Process Integrator

  1. Configure and bring up WebLogic Server with WebLogic Process Integrator, according to the procedure in Configuring WebLogic Collaborate for WebLogic Process Integrator.

    This ensures that your environment is configured to run WebLogic Process Integrator and WebLogic Server.

  2. Shut down WebLogic Server before proceeding to Step 2: Building the Example. (Type Ctrl+C in the command window where WebLogic Server is running.)

Step 2: Building the Example

To build the WebLogic Process Integrator Verifier example application, complete the following procedure:

  1. Open a new command window, change directory to the location where WebLogic Collaborate is installed, and execute the script to set the WebLogic Collaborate environment variables:

    Windows

    prompt> cd %WLC_HOME%

    prompt> setEnv.cmd

    UNIX

    prompt> cd $WLC_HOME

    prompt> . ./setenv.sh

  2. Build the example to populate the compiled classes and required scripts:

    Windows

    prompt> cd %WLC_HOME%\examples\wlpiverifier

    prompt> build.cmd

    UNIX

    prompt> cd $WLC_HOME/examples/wlpiverifier

    prompt> . ./build.sh

Step 3: Starting the C-Hub

To start WebLogic Server and the c-hub, execute the following commands:

Windows

prompt> cd %WLC_HOME%\hub\config\mydomain

prompt> startweblogic.cmd

UNIX

prompt> cd $WLC_HOME/hub/config/mydomain

prompt> . ./startweblogic.sh

Note: Make sure WebLogic Server is still running before proceeding to Step 5: Importing and Deploying the Workflow Templates.

Step 4: Starting the C-Enabler

  1. Open a new command window, change directory to the location where WebLogic Collaborate is installed, and execute the script to set the WebLogic Collaborate environment variables:

    Windows

    prompt> cd %WLC_HOME%

    prompt> setEnv.cmd

    UNIX

    prompt> cd $WLC_HOME

    prompt> . ./setenv.sh

  2. Change directory to where the c-enabler is located:

    Windows

    %WLC_HOME%\enabler\config\mydomain

    UNIX

    $WLC_HOME/enabler/config/mydomain

  3. Open the config.xml file and uncomment the lines indicated in bold in the following listing:

    Listing 3-1 wlpiverifier Example

    <!-- for wlpiverifier example
    <StartupClass

    Arguments="ConfigFile=xml/enablers.xml,SessionName=caller-session,User=bea,P
    assword=12345678,OrgName=BEA"
    ClassName="com.bea.b2b.wlpi.Start"
    Name="WlpiVerifierCaller"
    Targets="myserver"
    />

    <StartupClass

    Arguments="ConfigFile=xml/enablers.xml,SessionName=callee-session,User=bea,P
    assword=12345678,OrgName=BEA"
    ClassName="com.bea.b2b.wlpi.Start"
    Name="WlpiVerifierCallee"
    Targets="myserver"
    />
    -->

  4. Start WebLogic Server:

Windows

prompt> startweblogic.cmd

UNIX

prompt> . ./startweblogic.sh

Note: You may get warning messages in the WebLogic Server log indicating that there are no active WebLogic Process Integrator templates for session caller-session in organization BEA. You can ignore these messages and continue to Step 5: Importing and Deploying the Workflow Templates.

For more information about configuring the c-enabler, see the BEA WebLogic Collaborate C-Enabler Administration Guide.

Step 5: Importing and Deploying the Workflow Templates

A WebLogic Process Integrator workflow template is a folder or a container for workflow template definitions. Each workflow template can hold one or more WebLogic Process Integrator workflow template definitions.

To import the workflow templates from the templates directory into WebLogic Process Integrator Studio, and deploy them in WebLogic Process Integrator Studio, complete the following procedure:

  1. Open a new command window, change to the directory where WebLogic Collaborate is installed, and execute the script to set the WebLogic Collaborate environment variables:

    Windows

    prompt> cd %WLC_HOME%

    prompt> setEnv.cmd

    UNIX

    prompt> cd $WLC_HOME

    prompt> . ./setenv.sh

  2. Change to the directory where WebLogic Process Integrator scripts are installed:

    Windows

    %WLC_HOME%\wlpi

    UNIX

    $WLC_HOME/wlpi

  3. Execute the following script to start WebLogic Process Integrator Studio, and display the WebLogic Process Integrator Studio login dialog box:

    Windows

    prompt> Studio.cmd

    UNIX

    prompt> . ./studio.sh

    The WebLogic Process Integrator Studio login dialog box is displayed.

    Figure 3-1 Logon to WebLogic Process Integrator Dialog Box

  4. Enter the BEA user name (bea) and password (12345678) in the dialog box.

  5. In the Server text field, enter the following:

    t3://localhost:7501

    where localhost represents the name of your machine.

  6. Click OK to log in to WebLogic Process Integrator Studio and display the WebLogic Process Integrator Studio main window.

    Figure 3-2 WebLogic Process Integrator Studio Main Window

  7. Right-click on Templates, and click Create Template to display the Template Properties dialog box.

    Figure 3-3 Template Properties Dialog Box

  8. Enter the workflow template name (wlpiverifier_init) and click OK.

  9. Repeat steps 8 and 9 to generate a second workflow template named wlpiverifier_partner.

    The WebLogic Process Integrator Studio screen displays the two workflow template folders you created.

  10. Right-click on the wlpiverifier_init workflow template folder and choose Import Template Definition.

    Figure 3-4 WebLogic Process Integrator Import Template Definitions Menu

  11. Navigate to the %WLC_HOME%\examples\wlpiverifier\templates directory and select the appropriate workflow template:

  12. Right-click on the wlpiverifier_init subfolder (the folder identified by the effective date (Figure 3-5)) and choose Open to display the workflow template definition in WebLogic Process Integrator Studio.

    Figure 3-6 WebLogic Process Integrator Workflow Template Definition

  13. Right-click on the wlpiverifier_init subfolder (the folder identified by the effective date (Figure 3-5)) and choose Properties from the drop-down menu.

    The Template Definition dialog box is displayed.

    Figure 3-7 Template Definition Dialog Box

  14. Select the Active check box and click OK.

  15. Right-click on the wlpiverifier_init subfolder and choose Save.

    Figure 3-8 Save Workflow Definition Menu

  16. Click Yes.

    The steps to import and deploy the wlpiverifier_init workflow template are complete.

  17. Repeat steps 11 through 17 to import and deploy the wlpiverifier_partner workflow template.

  18. Exit the WebLogic Process Integrator Studio.

Step 6: Running the Example

To run the WebLogic Process Integrator Verifier example application, complete the following procedure:

  1. Make sure the c-hub and c-enabler are still running (see step 3 and step 4 above).

  2. Invoke a Web browser with the following URL:

    http://localhost:7501/wlpiVerifier.html

    where localhost represents the name of your machine.

    The HTML page used to start the example application is displayed in your browser.

    Figure 3-10 WebLogic Process Integrator Verifier Example Start Page

  3. Click Submit to start the wlpiverifier_init workflow.

    The application starts. If the application executes successfully, a report containing the results is displayed in the browser.

    Figure 3-11 WebLogic Process Integrator Verifier Example Report Page

  4. If errors occur, check the WebLogic Server log for more information.

Running the Example on a Single WebLogic Server Instance

When you configure your system to execute the example application on a single instance of WebLogic Server, the c-hub and two c-enablers are colocated on that same instance.

Make sure that the following conditions are met before running the colocated example:

Configure the Verifier

To configure the Verifier example application to execute on a single instance of WebLogic Server, complete the following procedure.

  1. Open a command window. Change to the directory where WebLogic Collaborate is installed, and execute the script to set the WebLogic Collaborate environment variables:

    Windows

    prompt> cd %WLC_HOME%

    prompt> setEnv.cmd

    UNIX

    prompt> cd $WLC_HOME

    prompt> . ./setenv.sh

  2. Change to the following directory:

    Windows

    %WLC_HOME%\hub\config\mydomain

    UNIX

    $WLC_HOME/hub/config/mydomain

  3. It is recommended that you make a copy of the config.xml file. You will edit this file in step 4 below and then use the edited config.xml file when you run the WebLogic Process Integrator Verifier example application on a single instance of WebLogic Server.

  4. Open the config.xml file and locate the section in the file that applies to running the WebLogic Process Integrator Verifier example application on a single instance (colocated c-enablers) of WebLogic Server.

    Warning: Any comments you add to config.xml are lost when WebLogic Server restarts. Before editing config.xml with an editor, or before restarting WebLogic Server, you should make a backup copy of config.xml by copying it to an alternative location. You can use the backup copy as a guide, if required, to the contents of the config.xml file. Although we have provided code snippets from config.xml in this manual, it is not necessary nor even desirable for you to manually edit config.xml. The code snippets are to allow you to compare your installation to a known working model. You should use the the WebLogic Server Administration Console to modify the server parameters.

  5. The steps in this procedure describe how to uncomment and configure this section of the config.xml file to match your environment.

    1. Search for the following sections and comment them out:

          <<StartupClass
      ClassName="com.bea.b2b.hub.Startup"
      Name="WLCStartup"
      Targets="myserver"
      />
      <<JMSServer
      Name="WLCJMSServer"
      Targets="myserver"
      />

    2. Search for the following line to identify the section of
      config.xml file that applies to the Weblogic Process Integrator example
      application running on colocated c-enablers.

      <<!-- uncomment next thru JMSServer
      element for WLPI colocated with hub -->

      Uncomment all the code in the section of the config.xml file. You should uncomment only one of the wlpiPool definitions (the one for the database you are using).

    3. Uncomment the wlpiPool that corresponds to the databases you are using. The following extract shows the property settings for the supported databases.

       <<!-- Cloudscape settings -->
      <<JDBCConnectionPool
      CapacityIncrement="1"
      DriverName="COM.cloudscape.core.JDBCDriver"
      InitialCapacity="1"
      LoginDelaySeconds="1"
      MaxCapacity="10"
      Name="wlpiPool"
      Properties="user=none;password=none"
      RefreshMinutes="0"
      ShrinkPeriodMinutes="15"
      ShrinkingEnabled="true"
      Targets="myserver"
      URL="jdbc:cloudscape:wlpidb"
      />

       <<!-- Oracle settings -->
      <<!--
      <<JDBCConnectionPool
      CapacityIncrement="1"
      DriverName="weblogic.jdbc.oci.Driver"
      InitialCapacity="1"
      LoginDelaySeconds="1"
      MaxCapacity="10"
      Name="wlpiPool"

      Properties="user=<<ORACLE_USER>;password=<<ORACLE_PASSWORD>;server=<<ORACLE_SERVICENAME>"
      RefreshMinutes="0"
      ShrinkPeriodMinutes="15"
      ShrinkingEnabled="true"
      Targets="myserver"
      URL="jdbc:weblogic:oracle"
      />
      -->

        <<!-- SQL Server settings (MSSQL) -->
      <<!--
      <<JDBCConnectionPool
      CapacityIncrement="1"
      DriverName="weblogic.jdbc.mssqlserver4.Driver"
      InitialCapacity="1"
      LoginDelaySeconds="1"
      MaxCapacity="10"
      Name="wlpiPool"
      Properties="user=<<MSSQL_USER>;password=<<MSSQL_PASSWORD>"
      RefreshMinutes="0"
      ShrinkPeriodMinutes="15"
      ShrinkingEnabled="true"
      Targets="myserver"
      URL="jdbc:weblogic:mssqlserver4:WLCDB@<<MSSQL_HOSTNAME>"
      />

    4. Within the wlpiPool property that has been uncommented, confirm that the configuration is correct for the database you are using:

    1. The Cloudscape database is a single-user database and requires no user ID and password configurations in the wlpiPool property.

    2. Find the text in the config.xml file that specifies the EJBComponent. The following extract from the file displays the wlpi EJBComponents deployed

       <<Application
      Name="WLPI Application"
      Path="D:/bea/wlcollaborate1.0.1/lib"
      >
      <<EJBComponent
      Name="wlpi-ejb.jar"
      Targets="myserver"
      URI="wlpi-ejb.jar"
      />
      <<EJBComponent
      Name="wlpi-mdb-ejb.jar"
      Targets="myserver"
      URI="wlpi-mdb-ejb.jar"
      />
      <</Application>

      Ensure that the pathname is correct for the WebLogic Collaborate
      lib directory on your system.

  6. Close the config.xml file.

  7. Open the wlcstartup.properties file and uncomment the lines indicated in bold in the following listing:

    # Start of WLPI Verifier example
    #WLCStartup.WLPIVerifierCaller=com.bea.b2b.wlpi.Start
    #ConfigFile=xml/enablers.xml
    #SessionName=caller-session
    #User=bea
    #Password=12345678
    #OrgName=BEA

    #WLCStartup.WLPIVerifierCallee=com.bea.b2b.wlpi.Start
    #ConfigFile=xml/enablers.xml
    #SessionName=callee-session
    #User=bea
    #Password=12345678
    #OrgName=BEA# end of WLPIVerifier example
    # End of WLPI Verifier example

  8. Close the wlcstartup.properties file.

  9. Open the web.xml file in the following location:

    $WLC_HOME/hub/config/mydomain/applications/DefaultWebApp_myserver/WEB-INF

    And search for the following string:

    <<!-- uncomment the following for
    colocated WLPI verifier example -->

    Uncomment that section to register the WlpiVerifier Servlet.

  10. Start the WebLogic Server, which starts the c-hub and two c-enablers:

    Windows

    prompt> startweblogic.cmd

    UNIX

    prompt> . ./startweblogic.sh

  11. Invoke a Web browser with the following URL:

    http://localhost:7001/wlpiverifier.html

    where

  12. Refer to Step 6: Running the Example to see the HTML pages used to invoke the example. From this point in the process, the application runs on a single instance of WebLogic Server in the same way as it does on two instances.

    Note: The port number is 7001 for the c-hub instance of WebLogic Server; the port number for the c-enabler instance is 7501 (Step 6: Running the Example).

 


Understanding the WebLogic Process Integrator Verifier Example

This section describes workflow definitions for the WebLogic Process Integrator Verifier example application. For complete details about integrating workflow templates with WebLogic Collaborate, see Using Workflows to Exchange Business Messages in the BEA WebLogic Collaborate Developer Guide.

Data is passed between WebLogic Process Integrator partner workflows (trading partners) in a WebLogic Collaborate conversation. During execution of the WebLogic Process Integrator Verifier example, the following events occur:

The application code manipulates the business messages that a workflow sends and receives using a class that implements the com.bea.b2b.wlpi.MessageManipulator interface.

Note: When you are using WebLogic Process Integrator Studio, you can view details for actions in any workflow task by double-clicking on the task in the workflow diagram. In the Actions box, click Activated. Select the action and click Update. A dialog box containing Class name, Input variable, and Output variable fields is displayed; the fields contain the name of the Java class to call, the name of a workflow variable to pass to the class, and name of the workflow variable that will be assigned the result of the class execution, respectively.

The wlpiverifier_init Workflow

This section describes the tasks in the wlpiverifier_init workflow diagram, and the variables associated with the wlpiverifier_init workflow.

Note: The variables associated with a workflow are displayed in a subfolder under the workflow template folder. To view the properties for a variable, right-click the variable name in the folder.

The following variables are associated with the wlpiverifier_init workflow:

requestMsg

A Java object that holds the message to be used in the Send Business Message action.

replyMsg

A Java object that holds the reply message received from a Receive Business Message event.

requestString[0-4]

Variables that hold the request data passed in by the client application. These variables are used to fill in elements when the request message is being constructed. (The parameter properties for these variables are marked as input.)

replyString[0-4]

Variables that hold the reply data. When a reply message is received, the relevant data is extracted from the message and assigned to these variables. The WebLogic Process Integrator Verifier example application code accesses the replyString variables to obtain the data that it returns. (The parameter properties for these variables are marked as output.)

noOfRecipients[0-4]

Variables that hold the number of recipients who received each of the requests. One variable is assigned for each message send.

noOfRecipientsHolder

A variable that holds the number of recipients who received the request. The value from the variable is then used to assign the variables noOfRecipients[0-4] described above.

current

The counter for the current message. For each current count, the workflow takes a requestString[current] and constructs a request message.

last

A variable used to indicate the final request. When last is set, the workflow moves to the end stage.

sendStatus

A Boolean value representing the status of the WebLogic Collaborate send.

The following figure shows the wlpiverifier_init workflow.

Figure 3-12 The wlpiverifier_init Workflow

Start Node (Green Circle)

This is the beginning of the workflow. It is started programmatically by WlpiVerifierServlet.java. To see how this is done, refer to the startworkflow method in the servlet class.

Publish Request Message (Blue Box)

This is the first task in the workflow. It consists of the following three actions:

Decision Box:Send Status (Yellow Diamond)

This decision box determines whether the workflow should end or continue. The value placed in Send Status is evaluated to determine whether the message was sent successfully. If the evaluation is true, the workflow proceeds to the Receive Reply task, if the evaluation is false, the workflow fails and moves to the failure node. This failure node issues a conversation terminate failure to all participants in the conversation.

Receive Reply (Green Star)

This task waits for a business message to arrive, that is, it waits for a response message from the callee (wlpiverifier_partner). Associated with this action is a Target variable (replyMsg). The received business message is assigned to this variable.

Prepare Reply (Blue Box)

This task contains the following actions:

Decision Box (Yellow Diamond)

This decision box determines if the count is less than five, and if the last variable is set to true or false. If the action is true, another iteration is performed, sending another message. If the action is false, the workflow terminates.

Done Node (Red Circle)

Terminates the workflow. A conversation terminate success is issued to all participants of the conversation.

The wlpiverifier_partner Workflow

This section describes the tasks in the wlpiverifier_partner workflow diagram, and the variables associated with the wlpiverifier_partner workflow.

Note: The variables associated with a workflow are displayed in a subfolder under the workflow template folder. To view the properties for a variable, right-click the variable name in the folder.

The following variables are associated with the wlpiverifier_partner workflow:

requestMsg

A Java object that holds the message that is sent by the wlpiverifier_init workflow.

replyMsg

A Java object that holds the message to be sent as a reply to the wlpiverifier_init workflow.

last

A variable used to indicate the final request. When last is set to true, the workflow moves to the end stage.

convTerminateSuccess

A Boolean value representing conversation termination status.

senderName

A string containing the name of the message sender.

sendStatus

A Boolean value representing the status of the WebLogic Collaborate send business message.

The following figure shows the wlpiverifier_partner workflow.

Figure 3-13 The wlpiverifier_partner Workflow

Start Node (Green Circle)

This is the beginning of the wlpiverifier_partner workflow. When a message intended for this workflow arrives, the workflow is started by the c-enabler code. The message is then ready for processing. The format for the business message is specified in the requestMsg variable.

Process Request (Blue Box)

This task consists of the following actions:

Decision (Yellow Diamond)

This decision box determines if the workflow should finish based on the value of the workflow Boolean variable last. If last is set to false, the workflow proceeds to receive another request. If true, the workflow waits for conversation termination.

Receive Other Request (Green Star)

This task waits for a business message to arrive, that is, the Receive Other Request event waits for the next message from the caller (wlpiverifier_init). Associated with this action is a Target variable (requestMsg), and a Sender's Name (senderName ).

Wait for Conversation Termination (Green Star)

This task blocks and waits for the initiator of the conversation (wlpiverifier_init) to terminate the conversation, if the last message has been received. It places the Termination Status in the defined workflow variable (convTerminateSuccess).

Decision (Yellow Diamond)

This decision box determines whether to end the conversation based on the value of the workflow Boolean variable convTerminateSuccess.

An Application May Do Some Error Processing Here (Blue Box)

Error processing tasks can happen at this node in the workflow.

Done Node (Red Circle)

End of the workflow. A conversation leave is issued.

Understanding WebLogic Process Integrator Java Classes

Business operations use WebLogic Process Integrator variables and Java code to manipulate business messages that are exchanged between trading partners. In general, the workflows sequence the flow of data, and Java classes process the data. The Java classes read and write the workflow variables using the WebLogic Process Integrator API.

The following Java classes are used in the WebLogic Process Integrator Verifier example application. For more details about business operations, see Using Workflows to Exchange Business Messages in the BEA WebLogic Collaborate Developer Guide.