|
|
| 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:
- WebLogic Server creates a WLEC connection pool for the Simpapp sample application.
-
The Simpapp Servlet init method obtains a connection from the WLEC connection pool.
- The form-based Internet client sends a request, including an input string, to the servlet.
- 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.
-
The servlet then invokes the desired operation on the Simple object with the
data that it received from the Internet client.
- 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.
- 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:
- Prerequisites
- Build the Example
- Configure the Server
- Run the Example
Install and configure the following:
- WebLogic Server
- WebLogic Enterprise Connectivity
- BEA Tuxedo version 8.0
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 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.
- Set up your WebLogic Server development shell as described in
Setting up your environment for building and running the examples.
- Modify your CLASSPATH as follows:
- 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).
- Add %WL_HOME%\lib\wleorb.jar (Windows 2000) or $WL_HOME/lib/wleorb.jar (UNIX) to the CLASSPATH for the startup script.
- Add %WL_HOME%\lib\wlepool.jar (Window 2000) or $WL_HOME/lib/wlepool.jar (UNIX) to the CLASSPATH for the startup script.
- 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.
- 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:
- Simple.class
- SimpleFactory.class
- SimpleHelper.class
- SimpleFactoryHelper.class
- _SimpleStub.class
- _SimpleFactoryStub.class
- Build the Simpapp servlet by running the ant build script in the /examples/wlec/servlets/simpapp directory.
p>
- 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
- Bring up the WebLogic Server Administration Console in a browser.
- Create a WLEC Connection Pool:
- Go to the Services->WLEC node in the left pane of the Administration Console.
- Click the Create a new WLEC Connection Pool link.
- Click the General tab.
- Create a new WLEC connection pool called simplepool.
- 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.
- 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.
- Move the examplesServer from the Target column to the Chosen column.
- Click the Apply button.
- Make sure that the examplesWebApp is deployed on your server.
Run the Example
- Start a web browser and enter the URL for Simpapp.html. For example:
http://localhost:7001/examplesWebApp/Simpapp.html
- On the HTML form:
- Enter some text in either uppercase or lowercase.
- Select the operation. (TO UPPER or TO LOWER)
- Click GO.
- 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.
Copyright © 2001 BEA Systems, Inc. All Rights Reserved.