bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

B2B Samples

Hello Partner Sample (Deprecated)

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

- Overview of the Hello Partner Sample

- Before Running the Hello Partner Sample

- Running the Hello Partner Sample

- How the Sample Works

Note: The Hello Partner sample is based on the XOCP protocol, which is deprecated in this release of WebLogic Integration. For information about the feature that is replacing XOCP, see BEA WebLogic Integration Release Notes.

Overview of the Hello Partner Sample

The Hello Partner sample demonstrates business communications between two trading partners using WebLogic Integration.

What the Sample Demonstrates

The Hello Partner sample demonstrates how two trading partners send business messages using the XOCP protocol. For each trading partner, the sample demonstrates the following:

- Public process—A public process that handles communication between the trading partners is shown. The public process workflows in this sample use the XOCP protocol to send messages between trading partners.

- Private process—A private process for each trading partner that processes message content is shown.

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, as shown in Figure 2-1. The following figure shows the high-level interactions between the different Hello Partner workflows.

Figure 2-1 Interactions Among Hello Partner Workflows

Notes: The public workflows are shaded in gray in the preceding figure.

The following sequence summarizes the main events in this scenario:

1. The RunSamples script is started, with the following results:

   1. The sample instance of WebLogic Server is started.

   2. A browser opens and displays the samples launcher page.

   3. On the samples launcher page, the Hello Partner link is clicked: the Hello Partner main HTML page is displayed.

2. Values for the integers are selected from the menu. The Click Here to Begin link is selected. Consequently, the Hello Partner main HTML page sends an HTTP request to the HelloPartnerServlet. The HTTP request contains the selected integer values.

3. The HelloPartnerServlet sends an JMS XML event with the integer values.

4. The preceding JMS XML event triggers the RequestorPrivate workflow to start. The RequestorPrivate workflow composes the MultiplyRequestXML workflow variable and starts the RequestorPublic workflow, passing in the MultiplyRequestXML workflow variable. The RequestorPublic workflow then waits for a response from the replier.

5. The ReplierPublic workflow receives the message and extracts integer values from the MultiplyRequestXML workflow variable. It puts these values into the MultiplyInputsXML workflow variable and posts an internal XML event.

6. The ReplierPrivate workflow is triggered by the preceding internal XML event. The ReplierPrivate workflow multiplies the two integers, places the result in the MultiplyOutputsXML workflow variable, and post an internal XML event with the MultiplyOutputsXML workflow variable.

7. The ReplierPublic workflow, which was waiting for the preceding XML event, creates a MultiplyReplyMessage input message workflow variable and sends it with a business message.

8. The RequestPublic workflow, which was waiting for the preceding business message, extracts values from the MultiplyReplyMessage workflow variable, creates the MultiplyReplyXML workflow variable, and posts it with an internal XML event.

9. The RequestPrivate workflow, which was waiting for the preceding XML event, creates the ResultXMLForJSP workflow variable and posts it with an external XML event.

10. The HelloPartnerServlet receives the XML event, extracts the result of the multiplication of the two integers from the XML, and displays it in the browser.

Before Running the Hello Partner Sample

Before running the Hello Partner sample, complete the following steps:

1. Follow the instructions in Preparing to Run the Samples.

2. Make sure the proxy settings on your browser do not prevent you from connecting to the sample WebLogic Server. For more information, see "Web Browser Configuration Requirements" in WebLogic Integration Administration and Design Tools in Starting, Stopping, and Customizing BEA WebLogic Integration.

Running the Hello Partner Sample

To run the Hello Partner sample:

1. Go to WLI_HOME (the directory in which you installed WebLogic Integration):

   >     cd WLI_HOME

   - Windows example:

   If you installed WebLogic Platform in the c:\bea directory, WLI_HOME represents the following pathname: c:\bea\weblogic700\integration.

   - UNIX example:

   If you installed WebLogic Platform in the /home/me/bea directory, WLI_HOME represents the following pathname: /home/me/bea/weblogic700/integration.

2. To set the top-level WebLogic Integration environment variables, run the setenv script appropriate for your platform:

   - On Windows:

   >     setEnv

   - On UNIX:

   >     . setenv.sh

3. Start the RunSamples script by completing the procedure appropriate for your platform:

   - Windows:

   Choose Start—>Programs—>BEA WebLogic Platform 7.0—>WebLogic Integration 7.0—>Integration Examples—>Start Server and Launch Examples (with dataloader).

   - UNIX:

   a) Make sure your PATH environment variable includes the directory in which the Netscape executable (netscape) resides.

   b) Run the RunSamples script:

   >     cd $SAMPLES_HOME/integration/config/samples
   >     RunSamples

   Warning: For UNIX systems, the directory in which the netscape executable resides must be included in your PATH environment variable. If it is not included, the samples launcher page is not displayed when the RunSamples script is run. You can start the samples launcher page by starting the Netscape browser on the same machine on which the RunSamples script is currently running, and entering the following URL:
   http://localhost:7001/index.html

4. 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 WebLogic Server as a background process and the samples launcher page is displayed.

   Figure 2-2 Samples Launcher Page

5. Click the link for Hello Partner, listed under Sample Applications in the left pane of the samples launcher page. The Hello Partner sample is displayed in the right pane.

   Figure 2-3 Hello Partner Sample Launcher Page

6. Select two numbers using the radio buttons. Click Start Sample.

   Figure 2-4 Hello Partner Sample Result Page

7. If you want to run more B2B samples at this time, keep the samples launcher page open and keep the instance of the WebLogic Server running.

   If you do not want to run more B2B samples at this time, exit from your browser and shut down the instance of the WebLogic Server by completing the procedure appropriate for your platform:

   - Windows:

   cd %SAMPLES_HOME%\integration\config\samples
   stopWebLogic

   - UNIX:

   cd $SAMPLES_HOME/integration/config/samples
   stopWebLogic

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. One private workflow connects to the servlet and the requestor's public workflow; another creates the replier's reply data.

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

- Documents Exchanged

- Requestor Private Workflow

- Requestor Public Workflow

- Replier Public Workflow

- Replier Private Workflow

Documents Exchanged

The following XML documents are used in the Hello Partner sample:

- Request Message from Requestor Role

- Reply Message from Replier Role

- XML Message Over JMS from Servlet to Trigger Private Workflow

- XML Message Over JMS from Private Workflow to Servlet with Result

- XML Event from Replier Public Workflow to Replier Private Workflow

- XML Event from Replier Private Workflows to Replier Public Workflows

The document type definitions (DTDs) for these documents are located in the SAMPLES_HOME\integration\samples\common\dtds directory for Window systems and the SAMPLES_HOME/integration/samples/common/dtds directory for UNIX systems. In both cases, SAMPLES_HOME represents the WebLogic Platform samples directory.

Request Message from Requestor Role

The following XML message is sent by the requestor. It includes the two numbers to be multiplied:

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

The message conforms to the multiply-request.dtd.

Reply Message from Replier Role

The following XML 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>

The message conforms to the multiply-reply.dtd.

XML Message Over JMS from Servlet to Trigger Private Workflow

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

>     <from-multiply-request-jsp-to-workflow light-weight="false">
>     	<integer-one>5</integer-one>
>     	<integer-two>7</integer-two>
>     </from-multiply-request-jsp-to-workflow>

>     The message conforms to the from-multiply-request-jsp-to-workflow.dtd.

XML Message Over JMS from Private Workflow to Servlet with Result

The following message is sent, over JMS, from the requestor's private workflow to the servlet. It contains the product of the multiplication, as well as a 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>

>     The message conforms to the from-workflow-to-multiply-request-jsp.dtd.

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>

>     The message conforms to the multiply-inputs.dtd.

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>

The message conforms to the multiply-outputs.dtd.

Requestor Private Workflow

The requestor private workflow receives the initial request from the servlet, 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 servlet. This process is illustrated by the workflow shown in the following figure.

Figure 2-5 Requestor Private Workflow

| An XML event received from the servlet triggers the workflow. The XML event is of the form <from-multiply-request-jsp-to-workflow>, as discussed in XML Message Over JMS from Servlet 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 it. A <from-workflow-to-multiply-request-jsp> document is created and sent to the servlet.
| A Done node ends the workflow.

Requestor Public Workflow

The Requestor public workflow is initiated by the private workflow. The Requestor public workflow receives a workflow variable from the private workflow. It then 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 shown in the following figure illustrates this process.

Figure 2-6 Requestor Public Workflow

| This workflow is initiated from the private workflow. The private workflow passes in the <multiply-request> document to this workflow. 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 Done 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 shown in the following figure.

Figure 2-7 Replier Public Workflow

| The workflow is started upon receipt of a <multiply-request> document. The Start node extracts the content from the message and stores it in a workflow variable. The format of the workflow variable is <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 Done 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 sends the reply XML back to the replier public workflow using an XML Event.

Figure 2-8 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 obtained by multiplying 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 Done node ends the workflow.