All Examples All WebLogic Enterprise Connectivity Examples
package examples.wlec.servlets.simpapp

WebLogic Enterprise Connectivity servlet simpapp example
about this example
This example demonstrates how to use WebLogic Enterprise Connectivity to
access a WebLogic Enterprise CORBA object from a servlet on a WebLogic Server.
- At startup:
- The WebLogic Server creates a connection pool for the Simpapp domain.
- The Simpapp servlet's init
method obtains a connection from the connection pool.
- At runtime, the HTML client sends a request and input string to the servlet.
- Acting as a WebLogic Enterprise client, the servlet's
service method:
- Activates the connection to the Simpapp domain.
- Invokes the desired operation on the Simple object with the
data that it received from the HTML 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 HTML client.
how to use this example
Prerequisites
Install and set up WebLogic Server, JDK, and WebLogic Enterprise.
See WebLogic platform support
for information about the supported versions of each of these products.
Setting up the example
- Build and run the WebLogic Enterprise Simpapp sample.
See Java
Simpapp Sample Application in the WebLogic Enterprise
documentation. 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.
You can use the C++ version of the Simpapp sample, which uses C++
client stubs instead of Java client stubs. If you use the C++
version, you must run the idltojava compiler on the simple.idl file to generate Java client stubs. For
information about manually generating client stubs, see Creating
CORBA Client Applications in the WebLogic Enterprise
documentation. You can get the idltojava compiler from Sun's Java
IDL Web page. The idltojava compiler must be run on a computer with a C++
development environment, since it runs the C precompiler on the .idl source.
-
Set up your WebLogic Server development environment as described in
Setting your development
environment.
- Copy the WebLogic Enterprise Simpapp client stubs to your
SERVER_CLASSES directory.
Copy all of these files:
- Simple.class
- SimpleFactory.class
- SimpleHelper.class
- SimpleFactoryHelper.class
- _SimpleStub.class
- _SimpleFactoryStub.class
-
Set up your WebLogic Server development environment as described in
Setting your development
environment.
- Compile the WebLogic Enterprise Connectivity Simpapp servlet Java class
with a command like this one for Windows NT:
$ javac -d %SERVLET_CLASSES% SimpappServlet.java
- Copy the file Simpapp.html
into the registered document root, which defaults to myserver/public_html.
- Register SimpappServlet 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
For information about the weblogic.properties file, see HTTP-
and servlet-related properties in the WebLogic Administrators
Guide.
- Set up an IIOP connection pool by adding to the weblogic.properties file a property similar to
this one:
weblogic.CORBA.connectionPool.simplepool=\
domainname=simpapp,\
appaddrlist=//hostname:port,\
minpoolsize=2,\
maxpoolsize=5
See the Administrators Guide Setting
up WebLogic Enterprise Connectivity.
Running the example
If you are using Java 2, Version 1.2, be sure that the Java system
classpath in your server shell includes ./lib/poolorb.jar. In startWebLogic.sh the startWebLogic.cmd, you can add this .jar file to
the JAVACLASSPATH environment variable.
- Start the WebLogic Server 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.
- 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...
Read more about installing, configuring, and using WebLogic Enterprise Connectivity in:
Copyright © 1999 BEA Systems, Inc.
All rights reserved.
Last updated 9/13/1999