All Examples All WebLogic Enterprise Connectivity Examples
WebLogic Enterprise Connectivity Servlet Simpapp Example
package examples.wlec.servlets.simpapp

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:
- At startup:
- WLS creates a WLEC Internet Inter-ORB Protocol (IIOP) connection pool for the WLE Simpapp domain.
- The Simpapp servlet init
method obtains a connection from the IIOP connection pool.
The remaining steps are performed at run time.
- The form-based Internet client sends a request, including an input string, to the servlet.
- Acting as a WLE client, the servlet service method:
- Activates the connection to the Simpapp domain.
- Invokes the desired operation on the Simple CORBA 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.
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
- Build and run the WLE Simpapp sample.
See the Java Simpapp Sample Application in the WLE documentation:
- Go to J2EE Topics on the Web.
- Scroll down and click Sample Applications.
- 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.
- Set up your WLE development environment as described in
Setting Your Development Environment.
- 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
- 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
- Copy the file Simpapp.html
into your registered document root, which defaults to myserver\public_html.
- 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.
- 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
- 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.
- Start WLS in your server shell.
- Start a Web browser and enter the URL for Simpapp.html. For example:
http://localhost:7001/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.
Related Documents
For information about WLS servlets:
For information about WLE CORBA objects:
- The WLE CORBA Programming Environment:
- Go to Getting Started on the Web.
- Click The WLE CORBA Programming Environment.
- Developing WLE CORBA Applications:
- Go to Getting Started on the Web.
- Click Developing WLE CORBA Applications.
- CORBA Topics on the Web.
For information about the WLE Simpapp example:
- Go to J2EE Topics on the Web.
- Scroll down and click Sample Applications.
- 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
|