BEA Logo BEA Collaborate Release 2.0

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

   Collaborate Documentation   |   Samples Guide   |   Previous Topic   |   Next Topic   |   Contents

Hello Partner Sample

 

The Hello Partner sample demonstrates communication using the default XOCP messaging protocol. This section discusses the following topics:

 


Overview of the Hello Partner Sample

Most WebLogic Collaborate conversations take place between trading partners who have both installed WebLogic Collaborate. In such environments, the XOCP protocol is used to exchange messages via a hub. The Hello Partner sample demonstrates all aspects of this process.

What the Sample Demonstrates

The Hello Partner sample demonstrates how two or more trading partners can participate in business communication in a properly configured WebLogic Collaborate environment. Such communication occurs in a networking environment with a hub-and-spoke configuration. XOCP is used to carry messages between two trading partners. A hub and two spokes are created in your local WebLogic Collaborate installation to demonstrate the round-trip path of the message. For each trading partner, the sample demonstrates the following:

In this sample, a JSP-driven Web page initiates a message to the replying trading partner. The trading partner processes the data in the message and sends a reply to the initiating trading partner, which is displayed by a second Web page.

This sample also illustrates the preferred method of handling trading partner message traffic. Public processes are used to manage trading partner message traffic, while private processes are used for message creation, message processing, and links to outside applications.

Hello Partner Sample Scenario Logic

The Hello Partner sample scenario involves two trading partners, one requestor and one replier, both of which communicate via a hub-and-spoke WebLogic Collaborate configuration. The requestor sends a message and waits for a response from the replier. The requestor uses a Web browser to access a JSP page that initializes and sends a message in XML, using JSP tags that are embedded in the browser pages.

The replier receives the message, generates a response, and publishes the response to the requestor in XML. The response is sent to the requestor, and the contents of the reply are displayed in the requestor's JSP page.

Running the Hello Partner sample demonstrates the following events:

The actual message content used in the sample is relatively simple. The JSP page allows you to select two numbers. These numbers are sent to the Replier, where they are multiplied. The multiplication result is returned.

 


Setting Up the Hello Partner Sample

The Hello Partner sample is designed to allow you to verify that you have properly installed WebLogic Collaborate. The Hello Partner sample runs in its own database domain, the Sample domain, rather than in your development or production domain. This isolates the database tables used by the Hello Partner sample from any development or production configurations or data you may load into WebLogic Collaborate before or after running Hello Partner.

To load the Hello Partner sample:

  1. Install WebLogic Collaborate and WebLogic Process Integrator.

  2. Verify that user Joe has been created during the installation of WebLogic Process Integrator Studio, with password password. This user account is created during installation by default.

  3. Load the Hello Partner database setup using the Bulk Loader.

  4. Start WebLogic Collaborate.

  5. Start the WebLogic Process Integrator Studio.

    On Windows systems:

    Choose Start—>Programs—>BEA WebLogic E-Business Platform—>WebLogic Integration 2.0—>Collaborate—>Samples—>Start Studio.

    On UNIX systems:

    Run the following shell script from the $WLC_HOME/config/samples/shortcuts directory:

    sh studio.sh&

    To log in, use the following information:

  6. Verify that ORG1 has been selected as the organization.

  7. Import the Hello Partner jar file into the WebLogic Process Integrator Studio. Select Import Package... from the Tools menu. Select the following jar file:
    WLC_HOME\config\samples\workflows\HelloPartnerAndLighweightClient.jar

    Select the Activate workflows after import option before you click Import.

Once you have completed this procedure, WebLogic Collaborate will have loaded all Hello Partner sample data and configurations.

 


Running the Hello Partner Sample

Once you have loaded the Hello Partner sample, you can start it.

To run the Hello Partner sample:

  1. Choose Start—>Programs—>BEA WebLogic E-Business Platform—>WebLogic Integration 2.0—>Collaborate—>Samples—>Run Samples—>Hello Partner.

    For UNIX, load the following URL:

    HTTP://localhost:7001/HelloPartnerLauncher.html

    Figure 2-2 JSP Launcher Page


     

  2. Select two numbers.

  3. Click Click Here to Begin.

  4. The example sends the message to the Replier trading partner for multiplication, and then sends the result to the JSP. The Web page displays the following result.

    Figure 2-3 JSP Result Page


     

 


How the Sample Works

A total of four workflows are used in this sample. Two public workflows manage the requestor's and replier's sides of the XOCP message exchange, while two private workflows connect the JSP and the requestor's public workflow on one side, and creates the replier's reply data on the other.

The following sections provide an overview of this process and describe each type of workflow in detail:

Documents Exchanged

The following documents are used in the Hello Partner sample:

Request WLC Message from Requestor Role

This message is sent by the Requestor. It includes the two numbers to be multiplied and is packaged as a document of type multiply-request:

<multiply-request>
<integer-one>5</integer-one>
<integer-two>7</integer-two>
</multiply-request>

Reply WLC Message from Replier Role

The following message, sent by the Replier, contains the multiplication product, as well as a generated message:

<multiply-reply>
<integer-product>35</integer-product>
<note>Dear RequestorPartner: Here is the product of 7 and 5, from ReplierPartner to RequestorPartner.</note>
</multiply-reply>

XML Message Over JMS from JSP to Trigger Private Workflow

The following message is sent over JMS by the JSP. Its arrival triggers the Requestor's private workflow:

<from-multiply-request-jsp-to-workflow>
<integer-one>5</integer-one>
<integer-two>7</integer-two>
</from-multiply-request-jsp-to-workflow>

XML Message Over JMS from Private Workflow to JSP with Result

The following message is sent over JMS from the Requestor's private workflow to the JSP. It contains the product of the multiplication, as well as the text message:

<from-workflow-to-multiply-request-jsp>
<integer-product>35</integer-product>
<note>Dear RequestorPartner: Here is the product of 7 and 5 from ReplierPartner to RequestorPartner.</note>
</from-workflow-to-multiply-request-jsp>

XML Event from Replier Public Workflow to Replier Private Workflow

The following XML event contains the request input message, with four parameters (the two multiplication inputs, the name of the requestor, and the name of the replier):

<multiply-inputs>
<integer-one>5</integer-one>
<integer-two>7</integer-two>
<requestor-name>PartnerRequestor</requestor-name>
<replier-name>PartnerReplier</replier-name>
</multiply-inputs>

XML Event from Replier Private Workflows to Replier Public Workflows

The following XML event contains the reply output of the private workflow:

<multiply-outputs>
<integer-product>35</integer-product>
<note>Dear RequestorPartner: Here is the product of 7 and 5 from ReplierPartner to RequestorPartner.</note>
</multiply-outputs>

Requestor Private Workflow

The Requestor private workflow receives the initial request from the JSP, creates a message of the appropriate type, and sends it to the public workflow for transmission. When it receives the reply, it processes the reply message, and sends the results to the JSP. This process is illustrated by the workflow in the following figure.

Figure 2-4 Requestor Private Workflow


 


An XML event received from the JSP triggers the workflow. The XML event is of the form <from-multiply-request-jsp-to-workflow> discussed in XML Message Over JMS from JSP to Trigger Private Workflow. The Start node extracts the conversion string from XML, creates a <multiply-request> document, and stores it in a workflow variable.


The Action node starts the public workflow and passes it a workflow variable containing the <multiply-request> document.


The Event node waits for a <multiply-reply> document. When the <multiply-reply> document is received, the conversion string is extracted from the <multiply-reply> document. A <from-workflow-to-multiply-request-jsp> document is created and sent to the JSP.


A Stop node ends the workflow.

Requestor Public Workflow

The Requestor public workflow is initiated by the XML event from the private workflow. It creates a message with the request XML, sends the message to the Replier, waits for a response, extracts the response XML from the response message, and then passes the response to the private workflow for processing. The workflow in the following figure illustrates this process.

Figure 2-5 Requestor Public Workflow


 


The workflow is called by having a <multiply-request> document passed to it. The Start node extracts the message string and stores it in a workflow variable.


An Action node sends the <multiply-request> document inside an XOCP message to the Replier role, specifying PartnerReplier as the name of the Trading Partner.


An Event node waits for an XOCP reply message from the Replier. When the reply arrives, it extracts the <multiply-reply> document from the message and stores it in a workflow variable.


An Action node publishes the <multiply-reply> document as an XML Event.


A Stop node ends the workflow.

Replier Public Workflow

The Replier public workflow is initiated upon receipt of the Requestor's message. It receives the message, extracts the request XML from the message, publishes an XML event containing the request XML to trigger the replier private workflow, receives an XML event back from the replier private workflow, and sends a message containing the response XML back to the requestor as a reply. This process is illustrated by the workflow in the following figure.

Figure 2-6 Replier Public Workflow


 


The workflow is started upon receipt of a <multiply-request> document. The Start Node extracts the message content from the message and stores it in a workflow variable. The workflow variable is of format <multiply-input>, using the values from inside the <multiply-request> document, and the sender and replier names from within the message.


An Action node publishes the <multiply-inputs> document as an XML Event, initiating the private workflow.


An Event node waits for a response, which it receives as an XML Event containing a <multiply-outputs> document.


An Action node creates a <multiply-reply> document based on the <multiply-outputs> document. It stores the result in an XML workflow variable.


An Action node sends the message containing the <multiply-reply> document to the Requestor using XOCP.


A Stop node ends the workflow.

Replier Private Workflow

The Replier private workflow is initiated upon receipt of the XML Event containing the request XML from the Replier public workflow. It receives the request, processes the data, generates a reply in an XML document, and publishes the reply XML back to the replier public workflow using an XML Event.

Figure 2-7 Replier Private Workflow


 


The workflow is started when an XML Event containing a document of type <multiply-inputs > is received. The Start node stores the document in a workflow variable.


The Action node creates an integer workflow variable containing the product of the input integers from the <multiply-inputs> document.


The Action node creates a document of type <multiply-outputs> as a workflow XML variable. The values from the integer and note workflow variables in steps 2 and 3 are stored in this document.


The Action node publishes the <multiply-outputs> document as an XML Event.


A Stop node ends the workflow.

 

back to top previous page next page