Apache-SOAP Version 2.3: Installing the Server Side Under Apache Tomcat v4.0 And v4.1

NOTE: These instructions do apply to Tomcat 4.0 and 4.1. There are separate instructions for Tomcat 3.1, Tomcat 3.3 and Tomcat 3.2.

Getting Tomcat ready:

IMPORTANT: With Tomcat 4.0 and 4.1, you do not need to change the startup scripts or place any jar or class files in any of Tomcat's private directories. You need only place files within Tomcat's webapps directory. If you cannot resist, jars should be placed in %CATALINA_HOME%/lib and classes in %CATALINA_HOME%/classes. Anything placed in these directories is visible to all Web applications running on the Tomcat server, but cannot depend on any classes within Web applications.

Deploying Apache-SOAP on Tomcat:

There are two different ways to actually deploy Apache SOAP on Tomcat:

Method 1: Deploying the web archive.

The Apache SOAP distribution includes a web archive at /soap-2_3/webapps/soap.war. Simply drop this web archive into Tomcat's webapps directory (i.e. %catalina_home%\webapps). Note: If you copy the web archive into the webapps directory while Tomcat is running, Tomcat will need to be restarted before the Apache SOAP web application can be accessed.

Keep in mind that if you want to replace the deployed Apache SOAP web application with a later version that you will probably have to shut the server down, remove the expanded %catalina_home%/webapps/soap directory, and replace the %catalina_home%/webapps/soap.war file with the newer one.

Method 2: Creating a new <Context> in Tomcat's server.xml file.

There are two ways to approach this. First, you can add a new <Context> element for the WAR file into %catalina_home%/conf/server.xml:

<Context path="/soap" docBase="path-to-apache-soap/webapps/soap.war" debug="1" reloadable="true" />

With this approach, you must put the classes or jars for your services in %CATALINA_HOME%/classes or %CATALINA_HOME%/lib, respectively.

For the second approach, you first unjar the WAR file into the path-to-apache-soap/webapps/soap directory. Then you can add a new <Context> element into %catalina_home%/conf/server.xml:

<Context path="/soap" docBase="path-to-apache-soap/webapps/soap" debug="1" reloadable="true" />

With this method, you can either put your service classes and jars in %CATALINA_HOME%/classes or %CATALINA_HOME%/lib, or under path-to-apache-soap/webapps/soap/WEB-INF.

If your service classes depend on classes from Apache SOAP, they cannot be put in %CATALINA_HOME%/classes or %CATALINA_HOME%/lib, as the Apache SOAP classes are not visible to them there.

Accessing the Apache SOAP context:

You should be able to deploy services by pointing a browser to

http://hostname:port/soap

where hostname is the host on which Tomcat is running and port is the port. See the User's Guide for details on the administration tool. The SOAP end-point for invoking services on this server is:

http://hostname:port/soap/servlet/rpcrouter

Happy SOAP-ing!