      All Examples  All WebLogic Enterprise Connectivity Examples

WebLogic Enterprise Connectivity Servlet Simpapp Example

package examples.wlec.servlets.simpapp

- SimpappServlet

About This Example

This example demonstrates how to use WebLogic Enterprise Connectivity (WLEC) to access a WebLogic EnterpriseTM (WLE) CORBA object from a servlet on WebLogic ServerTM (WLS). The example combines a WLS servlet and the WLE Simpapp example.

The following figure illustrates the WLEC Servlet Simpapp example.

When you run the WLEC Servlet Simpapp example, the following events occur:

1. At startup:

   1. WLS creates a WLEC Internet Inter-ORB Protocol (IIOP) connection pool for the WLE Simpapp domain.
   2. The Simpapp servlet init method obtains a connection from the IIOP connection pool.

   The remaining steps are performed at run time.

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

3. Acting as a WLE client, the servlet service method:

   1. Activates the connection to the Simpapp domain.
   2. Invokes the desired operation on the Simple CORBA object with the data that it received from the Internet client.

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

   - Accept a string and return the string in uppercase.
   - Accept a string and return the string in lowercase.

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

How To Use This Example

This section describes how to set up and run the Servlet Simpapp example.

Prerequisites

Install and set up the following:

- WebLogic Server (WLS)
- Java Development Kit (JDK)
- WebLogic Enterprise (WLE

See Platform Support for WebLogic Enterprise Connectivity for information about the supported versions for each product.

Setting Up the Example

1. Build and run the WLE Simpapp sample.

   See the Java Simpapp Sample Application in the WLE documentation:

   1. Go to J2EE Topics on the Web.
   2. Scroll down and click Sample Applications.
   3. Click Java Simpapp Sample Application.

   The build procedure for the Java version of the Simpapp sample 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 WLE development environment as described in Setting Your Development Environment.

3. Copy the compiled WLE Simpapp client stubs to your WLS 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:

   - Simple.class
   - SimpleFactory.class
   - SimpleHelper.class
   - SimpleFactoryHelper.class
   - _SimpleStub.class
   - _SimpleFactoryStub.class

4. Compile SimpappServlet.java with one of the following commands.

   On Windows NT:

           javac -d %SERVLET_CLASSES% SimpappServlet.java

   On UNIX:

           javac -d $SERVLET_CLASSES SimpappServlet.java

5. Copy the file Simpapp.html into your registered document root, which defaults to myserver\public_html.

6. Register the servlet by adding the following properties to the weblogic.properties file:

   weblogic.httpd.register.SimpappServlet=examples.wlec.servlets.simpapp.SimpappServlet
   weblogic.allow.execute.weblogic.servlet.SimpappServlet=everyone

   Additionally, to let everyone request HTML files via the servlet, add the following line to the weblogic.properties file:

   weblogic.allow.execute.servlet.file=everyone

   For information about the weblogic.properties file, see HTTP and Servlet Related Properties in the WebLogic Administrators Guide.

7. Initialize an IIOP connection pool by modifying the weblogic.properties file.

   You can uncomment and edit the weblogic.CORBA.connectionPool.simplepool property in the weblogic.properties file. See Setting Up WebLogic Enterprise Connectivity.

Running the Example

1. Modify classpaths:

   - Add wleorb.jar to CLASSPATH in %WL_HOME%\setenv.cmd (NT) or $WL_HOME/setenv.sh (UNIX).

   - Add %WL_HOME%\lib\wleorb.jar (NT) or $WL_HOME/lib/wleorb.jar (UNIX) to JAVACLASSPATH.

     If you are going to start WLS by running startweblogic, set JAVACLASSPATH in the startweblogic.cmd file (NT) or the startweblogic.sh file (UNIX). Otherwise, set JAVACLASSPATH by means of another method such as the command line or the NT System Properties dialog.

   For information about setting classpaths for WLS, see Setting Up and Starting WebLogic Server.

2. Start WLS in your server shell.

3. Start a Web browser and enter the URL for Simpapp.html. For example:

   http://localhost:7001/Simpapp.html

4. On the HTML form:

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

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

Related Documents

For information about WLS servlets:

- Using WebLogic HTTP Servlets
- WebLogic HTTP Servlets Examples

For information about WLE CORBA objects:

- The WLE CORBA Programming Environment:

  1. Go to Getting Started on the Web.
  2. Click The WLE CORBA Programming Environment.

- Developing WLE CORBA Applications:

  1. Go to Getting Started on the Web.
  2. Click Developing WLE CORBA Applications.

- CORBA Topics on the Web.

For information about the WLE Simpapp example:

1. Go to J2EE Topics on the Web.
2. Scroll down and click Sample Applications.
3. Click Java Simpapp Sample Application.

See also Using WebLogic Enterprise Connectivity.

Copyright © 2000 BEA Systems, Inc. All rights reserved. Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher. Last updated 4/25/00