WebLogic Server 6.1 Code Examples, BEA Systems, Inc.

Package examples.wlec.servlets.simpapp

This example demonstrates how to use WebLogic Enterprise Connectivity to access a CORBA object from a WebLogic servlet.

See:
          Description

Class Summary
SimpappServlet This example demonstrates how a WebLogic Servlet can connect to WebLogic Enterprise and invoke an operation on a CORBA object.
 

Package examples.wlec.servlets.simpapp Description

This example demonstrates how to use WebLogic Enterprise Connectivity to access a CORBA object from a WebLogic servlet. The WebLogic servlet interacts with a CORBA object in the BEA Tuxedo Simpapp sample application.

When you run the WLEC Servlet Simpapp example:

  1. WebLogic Server creates a WLEC connection pool for the Simpapp sample application.

  2. The Simpapp Servlet init method obtains a connection from the WLEC connection pool.

  3. The form-based Internet client sends a request, including an input string, to the servlet.

  4. Acting as a BEA Tuxedo CORBA client, the servlet service method activates the connection to the BEA Tuxedo domain in which the Simpapp sample application runs.

  5. The servlet then invokes the desired operation on the Simple object with the data that it received from the Internet client.

  6. The Simple object performs the specified operation and returns the results to the Simpapp servlet. The Simple object can perform two operations:

  7. The Simpapp servlet compiles the results into a dynamically-generated HTML page and sends the page to the Internet client.

The following section describes how to build and run the example:

  1. Prerequisites
  2. Build the Example
  3. Configure the Server
  4. Run the Example

Prerequisites

Install and configure the following:

Note: BEA Tuxedo version 8.0 combines the CORBA functionality previously found in the WebLogic Enterprise product with the ATMI functionality.

See BEA WebLogic Server Platform Support for information about the supported versions for WebLogic Server and WebLogic Enterprise Connectivity. For information about the supported platforms for BEA Tuxedo, see Installing the BEA Tuxedo System.

Build the Example

  1. Build and run the Java Simpapp sample in the BEA Tuxedo product.

    The build procedure for the Java Simpapp sample application generates the client stubs and puts them in your working directory. Client stubs provide the programming interface for CORBA object operations.

  2. Set up your WebLogic Server development shell as described in Setting up your environment for building and running the examples.

  3. Modify your CLASSPATH as follows:

    1. Add %WL_HOME%\lib\wleorb.jar to the CLASSPATH in %WL_HOME%\config\examples\setExamplesEnv.cmd (Windows 2000) or $WL_HOME/config/examples/setExamplesEnv.sh (UNIX).

    2. Add %WL_HOME%\lib\wleorb.jar (Windows 2000) or $WL_HOME/lib/wleorb.jar (UNIX) to the CLASSPATH for the startup script.

    3. Add %WL_HOME%\lib\wlepool.jar (Window 2000) or $WL_HOME/lib/wlepool.jar (UNIX) to the CLASSPATH for the startup script.

    4. Add the RemoteObjectReference class to the CLASSPATH for the startup script. The RemoteObjectReference class is bundled in the wleclient.jar file in the %TUXDIR%\udataobj\java\jdk\wlej2eecl.jar.

    For information about setting the CLASSPATH for WebLogic Server, see Setting up your environment for building and running the examples.

  4. Copy the compiled Simpapp client stubs to your WebLogic Server SERVER_CLASSES directory, where SERVER_CLASSES is an environment variable that you set when you set up your development environment. The files you need to copy are:

  5. Build the Simpapp servlet by running the ant build script in the /examples/wlec/servlets/simpapp directory. p>
  6. Copy the Simpapp.html file located in the samples/examples/wlec/servlets/simpapp directory in the WebLogic Server directory structure to the config/examples/production_apps/examplesWebApp directory. The config/examples/production_apps/examplesWebApp directory is the location of the public files for examplesWebApp.

Configure the Server

  1. Bring up the WebLogic Server Administration Console in a browser.

  2. Create a WLEC Connection Pool:

    1. Go to the Services->WLEC node in the left pane of the Administration Console.

    2. Click the Create a new WLEC Connection Pool link.

    3. Click the General tab.

    4. Create a new WLEC connection pool called simplepool.

    5. In the Primary Address attribute, enter the address of the IIOP Listener/Handler that will be used to establish a connection between the WLEC connection pool and the BEA Tuxedo domain in which the Simpapp sample application runs.
      The format of the address is //hostname:port where hostname is the name of the machine on which BEA Tuxedo is running and port is the TCP port at which the IIOP Listener/Handler listens for incoming requests. The port value must be a number between 0 and 65535. The default value is 2468.

    6. In the Failover Address attribute, enter the address of an IIOP Listener/Hander that can be used if connections cannot be established with the IIOP Listener/Handler defined in the Primary Address attribute.
      The format of the address is //hostname:port where hostname is the name of the machine on which BEA Tuxedo is running and port is the TCP port at which the IIOP Listener/Handler listens for incoming requests. The port value must be a number between 0 and 65535. The default value is 2468.

      For more information about creating WLEC connection pools, see Managing Security.

    7. Move the examplesServer from the Target column to the Chosen column.

    8. Click the Apply button.

  3. Make sure that the examplesWebApp is deployed on your server.

Run the Example

  1. Start a web browser and enter the URL for Simpapp.html. For example:

    http://localhost:7001/examplesWebApp/Simpapp.html

  2. On the HTML form:

    1. Enter some text in either uppercase or lowercase.
    2. Select the operation. (TO UPPER or TO LOWER)
    3. Click GO.

  3. Watch for the results. An uppercase string will convert to lowercase and vice versa.

There's More...

For more information about WebLogic servlets, see:

For more information about BEA Tuxedo CORBA, see the BEA Tuxedo documentation.

For more information about WLEC, see Using WebLogic Enterprise Connectivity.


Documentation is available at
http://e-docs.bea.com/wls/docs61

Copyright © 2001 BEA Systems, Inc. All Rights Reserved.