bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

B2B Samples

 Previous Next Contents View as PDF  

Trading Partner Zeroweight Client Sample (Deprecated)

The Trading Partner Zeroweight Client sample demonstrates two communication methods used when one or more trading partner hosts no BEA software: browsers and file sharing. The sample is based on business practice functions and business processes for a requestor and replier communicating via either a browser or a file-sharing client.

This section includes the following topics:

Note: The Zeroweight sample is based on the JSP tag library for the WebLogic Integration Messaging API, the B2B browser client, and the B2B file-sharing client, all of which are deprecated as of this release of WebLogic Integration. For information about the features that are replacing the JSP tag library for the WebLogic Integration Messaging API, the B2B browser client, and the B2B file-sharing client, see BEA WebLogic Integration Release Notes.

 


Overview of the Zeroweight Client Sample

Most B2B integration conversations involve two trading partners that have both installed BEA WebLogic Integration. Browser and file-sharing clients provide a way to communicate with trading partners who have not installed BEA software. The Zeroweight Client sample demonstrates communication between a requestor trading partner using a browser client, and a replier trading partner using a file-sharing client.

Purpose of the Sample

The Zeroweight Client sample demonstrates how business communication can take place between a requestor and one or more repliers that do not have WebLogic Integration installations. This type of communication is accomplished by using two types of zeroweight clients that are configured in a remote or host B2B integration installation:

In this sample, a business operation called by the replier's private workflow gets a request from a preconfigured directory, creates a reply based on the request, and puts the reply into a preconfigured output directory. An actual FTP server is not used; in the sample, the business operation simulates an FTP server.

Zeroweight Client Sample Scenario and Diagrams

The Zeroweight Client sample scenario involves two trading partners (one requestor and one replier) who communicate via a remote WebLogic Integration installation that is preconfigured to handle zeroweight clients. The requestor sends a request for multiplication of two integer numbers. The replier performs the multiplication and returns the product to the requestor.

Use the browser of your choice on any machine other than the one on which you are running the samples instance of WebLogic Integration. By doing so, you create a situation in which the requestor does not have a local WebLogic Integration installation. Instead, it uses a browser to access the JSPs that reside on a remote installation of WebLogic Integration.

The JSPs create mailboxes and send XML requests using the JSP tag libraries provided by WebLogic Integration. The same JSPs are also used to check messages in the requestor's mailbox, and to delete messages from the requestor's and replier's mailboxes.

Note: The default configuration of the Zeroweight Client sample specifies that the sample instance of WebLogic Integration, the browser client, and the FTP client run on the same machine. In a production deployment of the Zeroweight Client sample, however, WebLogic Integration, the browser client, and the FTP client run on three different machines.

The replier also has no WebLogic Integration installation. It uses a third-party FTP server application to communicate with some trading partners. It may also use a proprietary mechanism for handling messages. The replier communicates with the requestor via a file-sharing client.

The Zeroweight Client sample demonstrates the following events:

  1. Requestor's private workflow is triggered by an XML event sent from a JSP tag in the browser client.

  2. Replier's public workflow is triggered by a reply placed in the replier's out mailbox by the file-sharing client.

  3. Requestor's message and replier's message are put in the appropriate mailboxes.

In the Zeroweight Client sample, four preconfigured mailboxes are used. Each trading partner uses one inbox and one outbox, as follows:

 


Before Running the Zeroweight Client Sample

Before running the Zeroweight Client 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 Zeroweight Client Sample

To run the Zeroweight Client sample, complete the following steps:

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

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

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

    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 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 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.


     

  5. In the left pane, click the link for the Trading Partner Zeroweight Client application under Sample Applications. The Zeroweight Client Main Page is displayed in the right pane.

    .
     

  6. Launch the file-sharing client by completing the steps appropriate for your platform:

    Note: If you start the file-sharing client before the first JSP is loaded, you get a repeated Mailbox not found exception. These exceptions can be ignored because mailboxes are created when the main JSP is loaded for the first time. Once the mailboxes are created, these exceptions no longer appear.

  7. Click Start Sample. The following window is displayed.

    .
     

  8. Select the following option: Go to the request input page. The Request for Multiplication page is displayed.


     

  9. Now send a message to BrowserTP1_Outbox, manually, by completing the following steps:

    1. Select two integers.

    2. Click—>Send Multiplication Request.

    Note: As a side effect of this step, SendmsgTag and the wrapper Mailbox API are tested.

    Your display is updated, as shown in the following figure.


     

  10. To check the replies that have arrived in your incoming mailbox, click Check all replies. A list of replies is displayed.


     

    Note: When the list of replies is checked, CheckallmsgTag is checked, too.

    If no replies are found, the following message is displayed.


     

  11. To delete all messages from the incoming and outgoing mailboxes of all participating trading partners (which, in the sample, are the mailboxes for BrowserTP1and FtpTP1), complete the following steps:

    1. Click Delete all messages in all mailboxes. A list of all the messages in all the B2B integration mailboxes is displayed.


       

    2. Click—>Delete all messages in all mailboxes again. The total number of messages deleted is displayed.

    Note: As a side effect of this procedure you also test DeleteallmsgTag.

  12. To delete a particular message from a mailbox, complete the following steps:

    1. In the Check All Replies window (shown in step 6), select a message.

    2. Click Delete.

      The Delete One Reply window confirms that the message has been deleted successfully.


       

    Note: As a side effect of this procedure, you also test DeletemsgTag.

  13. To view details about messages, complete the following steps:

    1. Click the link labeled Check all replies.

    2. Select the message in the Message ID column that you want to view. The View Reply Detail window is displayed.


       

  14. If you want to run more B2B samples at this time, keep the samples launcher page open and keep an instance of 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 WebLogic Server by completing the procedure appropriate for your platform:

 


Creating and Using Zeroweight Clients

This section provides the following information about creating and configuring zeroweight clients:

Zeroweight Client Source Files

WebLogic Integration delivers all the source files you need to create your own zeroweight clients. The Zeroweight Client sample shares B2B integration information with the Hello Partner sample.

The following table lists all the files delivered specifically for the Zeroweight Client sample. In all pathnames, SAMPLES_HOME represents the WebLogic Platform samples directory.

Source Directory

Subdirectories

and Files

Contents

SAMPLES_HOME\integration\samples\lightweightClient\src\wlcsamples\lightweightClient


Contains the source files for the business operation and its helper, both of which are called by workflow instance.

SAMPLES_HOME\integration\config\samples


LwcFileSync.dtd

DTD file for LwcFileSync.xml

LwcFileSync.xml

File read by the file-sharing client. You must modify the following sections for your environment:

SAMPLES_HOME\integration\samples\lightweightClient\lib


Contains original copies of the LwcFileSync.dtd and LwcFileSync.xml files in SAMPLES_HOME\integration\config\samples.

SAMPLES_HOME\integration\samples\bin


Script that starts the file-sharing client that is responsible for the following tasks:

SAMPLES_HOME\integration\config\samples\lightweightClient\


ftpDir\

Directory created for the execution of the Zeroweight Client sample. Contains two directories (FtpTP1_indir and FtpTP1_outdir) that simulate the in and out directories on the file-sharing client. Names are hard-coded for the sample.

Note: This directory and its subdirectories are created at run time.

integration\samples\lightweightClient\


web\

Contains the files for the Web application, such as *.jpg and *.jsp files.

web\lwcWebApp\


Contains the JSP tag library description file, and the web.xml file used by the Zeroweight Client Web application.

SAMPLES_HOME\integration\samples\lightweightClient\src\wlcsamples\lightweightClient\


tags\

Contains the reference implementation of the B2B integration JSP tag libraries. Used for message management by com.bea.lwclient.LwcMailbox.


 

Using the JSP Tag Library

The JSP tag library uses a wrapper to address the WebLogic Integration Messaging API. The JSP tag library is used with predefined workflows to interact with a mailbox, as shown in Figure  6-2.

Figure 6-2 Mailbox Scenario Using the JSP Tag Library


 

The mailbox shown here supplements the repository. The tag library accesses the mailbox as needed. The repository may also store mailbox messages.

Error handling is based on standard Java exception and error handling via the Mailbox API classes and JSP delivered to the browser client.

For a complete listing of the JSP tags, see JSP Tag Reference.

Note: The B2B JSP tag library for the WebLogic Integration Messaging API is deprecated as of this release of WebLogic Integration. For information about the features that are replacing this tag library, see BEA WebLogic Integration Release Notes.

Configuring a Zeroweight Client

This section is provided only for users who want to move the browser client or the file-sharing client to a machine other than the one on which the samples instance of WebLogic Integration is running. If you move a client in this way, follow the appropriate procedure in this section to configure your remote zeroweight client.

If you are running the Zeroweight Client sample and the samples instance of WebLogic Integration on the same machine, skip this section.

This section provides procedures for the following tasks:

Configuring a File-Sharing Client

A zeroweight client is a process that WebLogic Integration runs in a dedicated Java Virtual Machine. As such, it needs no security mechanisms. WebLogic Integration can serve any number of zeroweight clients that are defined in the LwcFileSync.xml configuration file. For additional information, see Edit the File-Sharing Configuration File later in this section.

Edit the WebLogic Integration Configuration File

Add the zeroweight trading partner configuration information listed in Listing 5-1 to the configuration file for B2B integration: config.xml.

Listing 6-1 File-Sharing Client Configuration

<StartupClass
ClassName="com.bea.lwclient.Startup"
Name="LwcStartup"
Targets="myserver"
/>

You can edit the configuration file in the preconfigured samples domain at the following location (where SAMPLES_HOME represents the WebLogic Integration samples directory):

SAMPLES_HOME\integration\config\samples\config.xml

Edit the File-Sharing Configuration File

To configure a zeroweight client, define it in LwcFileSync.xml. The file-sharing client configuration in LwcFileSync.xml must conform to LwcFileSync.dtd.

Note: LwcFileSync.dtd must reside in the directory from which the file-sharing client is started.

Listing  6-2 provides a sample DTD file. Replace the values shown in bold with values that are appropriate for your zeroweight client installation.

Listing 6-2 Sample LwcFileSync.dtd

<!-- This DTD describes file sharing client configuration file -->
<!ELEMENT wlcfilesyncconfig (wlcfilesync*) >

<!-- maxThreads The upper limit for number of threads permissible -->
<!-- in thread pool at a given point in time -->
<!ATTLIST wlcfilesyncconfig maxThreads CDATA #REQUIRED>

<!-- minThreads The lower limit for number of threads permissible -->
<!-- in thread pool at a given point in time -->
<!ATTLIST wlcfilesyncconfig minThreads CDATA #REQUIRED>

<!-- maxIdleTime The maximum time interval thread could be idle -->
<!-- else removed from the pool -->
<!ATTLIST wlcfilesyncconfig maxIdleTime CDATA #REQUIRED>

<!-- pollInterval Time interval defining wait interval before polling -->
<!ATTLIST wlcfilesyncconfig pollInterval CDATA #REQUIRED>

<!-- url Weblogic URL used for JNDI lookup -->
<!ATTLIST wlcfilesyncconfig url CDATA #REQUIRED>

<!-- debug flag used to turn debugging on/off -->
<!ATTLIST wlcfilesyncconfig debug (TRUE | FALSE) "FALSE">

<!-- The following element is used to configure details of LWTP -->
<!ELEMENT wlcfilesync EMPTY>

<!-- LWTP name -->
<!ATTLIST wlcfilesync name CDATA #REQUIRED>

<!-- path of the incoming directory on local file system -->
<!ATTLIST wlcfilesync directoryin CDATA #REQUIRED>

<!-- path of the outgoing directory on local file system -->
<!ATTLIST wlcfilesync directoryout CDATA #REQUIRED>

Listing  6-3 provides a sample XML file in which file-sharing clients are defined as zeroweight trading partners. Replace the strings shown in bold with values appropriate for your zeroweight client installation.

Listing 6-3 Sample LwcFileSync.xml

<?xml version="1.0"?>
<!DOCTYPE wlcfilesyncconfig SYSTEM "LwcFileSync.dtd">
<wlcfilesyncconfig maxThreads="9"
minThreads="3"
maxIdleTime="5000"
pollInterval="2000"
url="t3://localhost:7001"
debug="FALSE">
<wlcfilesync name="FtpTP1"
directoryin="<SAMPLES_HOME>/samples/integration/config/samples
/lightweightClient/ftpDir/FtpTP1_indir
"
directoryout="<SAMPLES_HOME>/samples/integration/config/samples
/lightweightClient/ftpDir/FtpTP1_outdir
"/>
</wlcfilesyncconfig>

Configuring a Browser Client

WebLogic Integration supports two methods of configuring a browser client, depending on the security paradigm to be used: HTTP and HTTPS, or SSL. The following sections provide instructions for these methods:

Configuring an HTTP Browser Client

To configure an HTTP zeroweight client, you must edit the web.xml file. To turn on security for a browser client, complete the following procedure:

  1. The JSP developer responsible for the HTML user interface for trading partner zeroweight client Web applications uses the sendmsg tag and provides the following mandatory argument: security = ON or OFF.

    Workflow template developers can also turn security on and off by invoking the wlcsamples.zeroClient.LwcBizOp.putMessage() method. This method also accepts a string (ON or OFF) as its last argument for SECURITY. To turn security on or off, the developer specifies one of these arguments.

  2. The person who deploys the hosted Web application modifies the web.xml file by adding security constraints for all users with permission to use the application. The pathname for this file is SAMPLES_HOME\samples\lightweightClient\web\lwcWebApp\web.xml, where SAMPLES_HOME represents the WebLogic Platform samples directory.

    For example, to provide a new user with the security privileges required to use the Web application lwcWebApp.war, add the following code:

  <security-constraint>
<web-resource-collection>
<web-resource-name>lwcWebApp</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>newpartner</role-name>
</auth-constraint>
</security-constraint>
  <login-config>
<auth-method>BASIC</auth-method>
</login-config>
  <security-role>
<role-name>newpartner</role-name>
</security-role>

  1. Make sure the user named newpartner is a valid WebLogic Server user. You can assign this username through either the WebLogic Server Administration Console or the WebLogic Integration B2B Console. For details, see the BEA WebLogic Server Administration Guide or Administering B2B Integration, respectively.

  2. Using the B2B Console, map newpartner user must be mapped to a valid trading partner zeroweight client in two steps:

    1. Create a trading partner zeroweight client.

    2. Map the user's identification to the appropriate trading partner record.

    For details, see Administering B2B Integration.

  3. Using the WebLogic Integration Studio, create a collaboration agreement between newpartner and the B2B integration hub. For details, see Using the WebLogic Integration Studio.

Configuring an HTTPS (SSL) Browser Client

To configure a zeroweight HTTPS (SSL) client, perform the following steps:

  1. Configure certificates on both the browser and the B2B integration nodes.

  2. Create a WebLogic Server user called newpartner, who can run the browser on behalf of a trading partner zeroweight client. You can create this user through either the WebLogic Server Administration Console or the WebLogic Integration B2B Console.

  3. Using the B2B Console, create the trading partner zeroweight client.

  4. Map newpartner to the appropriate trading partner record.

  5. Using the WebLogic Integration B2B Console, create a collaboration agreement between the zeroweight client and the B2B integration hub. For details, see Administering B2B Integration.

 


How to Recompile the Sample

If you have made any changes to the sample, you must recompile it before you can run it. To recompile your modified sample, complete the following procedure:

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

  2. Run the setenv script to set the top-level WebLogic Integration environment variables by completing the procedure appropriate for your platform:

  3. Go to the project directory:

  4. Execute the following command:

    ant all

 

Back to Top Previous Next