System Requirements
C++ Requirements: If you are writing a C++ application in WAI, you must use the following:
In general, Netscape recommends that you restrict WAI applications to run only on the local host machine (where the web server runs). You should also restrict login access to this machine to prevent unauthorized users from executing WAI applications. Read the material in Chapter 8, "Security Guidelines for Using WAI" for a complete explanation of these recommendations.
Understanding Version Differences
The process for setting up and running WAI applications differs between versions 3.0 and 3.01 of the Netscape web servers:
osagent
utility first. You can also use the osfind
utility (provided with 3.0 servers) to troubleshoot problems.
You can install a patch that fixes and improves the WAI programming interface to the Enterprise Server in the following ways:
osagent
is no longer required to be running. For more information on this patch and instructions on how to get it and
install it, go to http://help.netscape.com/filelib.html#wai.
The osagent
and osfind
utilities are no longer included with the 3.01 release of the web server, since the web server no longer requires these utilities to run. Table 3.1 Comparison of CGI program structure to WAI program structure
Table 3.2 lists the getRequestInfo
variables with CGI equivalents.
Table 3.2 WAI getRequestInfo
variables with corresponding CGI functions
Most of the CGI variables are the same as the getRequestInfo
variables in WAI. The other CGI variables are retrieved out of the netscape::WAI::HttpServerContext
object. Table 3.3 lists the CGI variables that correspond to the netscape::WAI::HttpServerContext
variables:
Table 3.3 WAIServerContext
methods with corresponding CGI functions
The CGI functions in Table 3.4 lists the CGI functions that have no equivalent in WAI.
Table 3.4 CGI variables that do not correspond to getRequestInfo
or WAIServerContext
variables
Setting Up the Web Server
In order to enable the web server to use applications written in WAI, you need to do the following:
osagent
is used to help operate the object request broker (ORB). See
"Starting osagent (3.0 Servers Only)" for details. If you are running a 3.01
version of a web server, you can ignore this step.
This patch release fixes and improves the WAI programming interface to
the Enterprise Server in the following ways:
osagent
is no longer required to be running.
(Note that OAD will start only out-of-process WAI applications in C/C++ only and is not supported on Windows NT.) For more information on this patch and instructions on how to get it and
install it, go to
http://help.netscape.com/filelib.html#wai.
See "Setting the Option to Enable WAI" for details.
Some of the WAI messages, such as the startup message, are only logged if
the server is configured to log messages at the "verbose" level.
For more information about logging WAI status messages, read "Logging
Status Messages".
osagent
, which is provided with 3.0 versions of Netscape web servers, is used to help operate the object request broker (ORB).
NOTE:
osagent
is not required for 3.01 versions of Netscape web servers and is no
longer packaged with those versions of the server.
osagent
is located in the server_root
/wai/bin
directory on UNIX and in the server_root
\wai\bin
directory on Windows NT. To run osagent
, enter the following command:
osagent -a 127.0.0.1The
-a
flag specifies the address that osagent
binds to. You should specify the localhost address (127.0.0.1
) for security reasons. For details on these reasons, see Chapter 8, "Security Guidelines for Using WAI".
On Windows NT, you can create a shortcut or program item that runs this command. If you have the Windows NT Resource Kit, you can use the SrvAny
command to create a service for osagent
. You can set up this service to automatically when your machine starts up. For details, consult the documentation in the Windows NT Resource Kit.
Setting the Option to Enable WAI
You need to configure the web server to interact with WAI applications and server
plug-ins.
Configuring the Server
When prompted, enter the username and password of the server
administrator.
This brings you to the Server Manager page for your server.
obj.conf
file:
obj.conf
file for your server (which is located in the server_root
/
server_id
/config
directory of your server).
In the Init
directive that executes the IIOPinit
function, add configuration parameters to specify changes to the ORB configuration.
After editing the obj.conf
file, you need to stop and start your server so that the server can read in the updated file.
NOTE: Before changing the configuration, you should be aware of the security issues involved with running WAI applications on other machines. See Chapter 8, "Security Guidelines for Using WAI" for details.
Init
directive for the IIOPinit
function.
Example of Configuring the ORB
For example, in a 3.0 version of a web server, suppose you are running the osagent
from IP address 205.217.229.39 on port 15001. By default, the web server expects the osagent
utility to run on the localhost IP address (127.0.0.1) under the default port.
In the obj.conf
file, change the Init
directive for the IIOPinit
function from:
Init LateInit="yes" fn="IIOPinit"
to:
Init LateInit="yes" fn="IIOPinit" ORBagentaddr="205.217.229.39" ORBagentport="15001"
In your WAI application, you also need to specify this argument when initializing the ORB and BOA. For example:
int bargc = 0;
char **bargv = new char *[3];
bargv[bargc++] = "-OAipaddr";
bargv[bargc++] = "204.200.215.98";
bargv[bargc] = 0;
// Initialize the ORB.
ORB orb = org.omg.CORBA.ORB.init(bargc, bargv);
// Initialize the BOA.
BOA boa = orb.BOA_init(bargc, bargv);
Logging Status Messages
Some of the status messages (such as the WAI initialization messages) are logged to the server's error log only if the server is running with the LogVerbose
option turned on. These are messages that are logged with the severity level LOG_VERBOSE
.
If you want these types of messages logged, edit the magnus.conf
file and add the following directive:
LogVerbose on
The verbose log information is stored in server-root
/https-
serverID
/logs/errors
and server-root
/https-
serverID
/logs/access
.
After editing the magnus.conf
file, you need to stop and start your server so that the server can read in the updated file. You can find the mangus.conf
file in server-root
/https-
serverID
/logs/config.
Compiling Applications and Server Plug-Ins
When compiling and linking your application or server plug-in, follow the tips in this section. (You can also look at the makefiles provided with the sample applications.)
Compiling C/C++ Applications
Follow these guidelines for compiling and linking C/C++ applications.
Include Directories
Add the following include directories to your makefile:
server_root
/include
(UNIX) or server_root
\include
(Windows NT)
server_root
/wai/include
(UNIX) or server_root\wai\include
(Windows NT)
-R
flag; on IRIX, use the -rpath
flag):
The following table lists the additional libraries that you need to link to:Table 3.6 Libraries That You Need to Link to
Compile Flags
The following table lists the flags and defines that you need to use:
Compiling C/C++ Server Plug-Ins
In addition to the tips above, follow these tips when compiling server plug-ins (which are shared libraries or dynamic link libraries):
server_root
/wai/java/nisb.zip
and server_root
/wai/java/WAI.zip
in your CLASSPATH
environment variable.
Setting Up Your Application with OAD
You can set up your WAI application with the Netscape Internet Service Broker's object activation daemon (OAD), a process which automatically starts up your application if it is not running.
For example, you may want to ensure that your application is always running and does not need to be started manually.
To set up your application with the OAD, follow these steps:
WAIWebApplicationService
WAIWebApplicationService
.
Compile and run your application at least once, in order to register your application with the web server's naming service.
You need to register your application before setting it up with OAD. OAD expects your application to be registered with the web server.
NS_SERVER_ROOT
- set this to the location of your server root directory (for example, /usr/netscape/suitespot
or C:\Netscape\SuiteSpot
) NS_SERVER_ID
- set this to your server identifier (for example, https-myhost
) ORBELINE_IMPL_NAME
- set this to name of the file created by the OAD; the OAD creates this file to keep track of object implementations. For example, if you want this file to be named myfile
, set ORBELINE_IMPL_NAME
to myfile
. ORBELINE_IMPL_PATH
- set this to the path to an existing directory where you want the OAD to generate the file specified by the ORBELINE_IMPL_NAME
environment variable. For example, if you want the file created under the /usr/tmp
directory, set ORBELINE_IMPL_PATH
to /usr/tmp
. LD_LIBRARY_PATH
(or SHLIB_PATH
on HP-UX) environment variable to the paths that include all shared libraries linked to by your object server.
For example, in C shell, you might enter the following commands before starting OAD and your webserver:
setenv NS_SERVER_ID https-gromit
setenv NS_SERVER_ROOT /usr/netscape/suitespot
setenv LD_LIBRARY_PATH /usr/netscape/suitespot/wai/lib:
/usr/netscape/suitespot/bin/https:
/usr/netscape/suitespot/lib:
/usr/local/java/lib
setenv ORBELINE_IMPL_NAME myfile
setenv ORBELINE_IMPL_PATH /usr/tmpIf you start OAD after setting these variables, the OAD will generate the file
/usr/tmp/myfile
to keep track of the object implementations.
For instructions on starting OAD, see the Netscape Internet Service Broker
Reference Guide for C++ or the Netscape Internet Service Broker Reference
Guide for Java.
regobj
is located in the server_root
/wai/bin
directory. For details on
the syntax for this command, see the Netscape Internet Service Broker
Reference Guide for C++. You need to specify "*" as the interface name.
You can pass arguments to the object server using the -a
option.
WASP
implemented by the WAI application /usr/local/ns-home/wai/bin/WASP
, use the following command:
regobj -o "*,WASP" -f /usr/local/ns-home/wai/bin/WASPThe example above assumes that the web server is running on port 80 of the machine named
-a httpServerName=bar:80
bar
. -DDISABLE_ORB_LOCATOR
flag. This minimizes potential problems with the osagent
utility.
For example, if you have written the Java class WASP.class
with WAI, use the following command to run your Java application:
java -DDISABLE_ORB_LOCATOR WASPNote that if you are specifying the
DISABLE_ORB_LOCATOR
option for osagent
, you must force the web server's basic object adapter (BOA) to listen on a particular port. To do this, follow the instructions below.
server_root
/server_id
/config directory on UNIX and the server_root
\server_id
\config directory on Windows NT), and change the following line:
Init LateInit="yes" fn="IIOPinit"
to:
Init LateInit="yes" fn="IIOPinit" OAport="21000"
OAport
option specifies the port selected where the web server's BOA listens. The example above sets up the BOA to listen to port 21000.
server_root
/wai/NameService/server_id
.* on UNIX or server_root
\wai\NameService\server_id
.* on Windows NT.
For example, delete
https-myhost.IOR
, https-myhost.sav
, and https-
myhost.bak
. These files are name service files for your currently registered
objects.
For example, start any WAS object servers. You must complete this step. If
you do not, you might not be able to register objects with the web server.
Last Updated: 12/04/97 16:12:11
Any sample code included above is provided for your use on an "AS IS" basis, under the Netscape License Agreement - Terms of Use