Deployment
----------
This is the part of the project that brings everything together.
We will now see how our java code is deployed to the Tomcat Server.
1. Package your project
First for easier deployment we will package our java project. For a good
description of java packages please see the following link.
Specifically we suggest that you name your package in the following way. This will greatly ease the deployment process:
Add the following line to the top of all your .java source files. (Note: This must be the first line in the file)
package samples.quotePackage;
Next you need to place all your source files in a directory called quotePackage that is in a directory called samples.
eg. C:\...\samples\quotePackage\
2. Compiling your project and Classpath
Compile your project as partially described earlier. The tricky part is that you must explicitly link in the libraries
that we downloaded earlier (mail.jar, activation.jar, soap.jar) You also need to add the directory to where your sample
directory lives. There are two main ways that you can do this.
One way is to create a CLASSPATH environment variable that points directly to these files. To do this:
Control Panel -> System -> Advanced -> Environment Variables -> System variables -> New
Variable name CLASSPATH
Variable value location of .jar files
eg. .;C:\mail.jar;C:\activation.jar;C:\soap.jar;C:\project5
Where C:\project5 contains the directories sample\quotePackage
Note: the soap.jar file can be found in the lib directory of the soap .zip archive.
The second way to do this is to use the compilation flag -classpath when compiling your program
eg. javac -classpath ".;C:\mail.jar;C:\activation.jar;C:\soap.jar;C:\project5" *.java
3. Copy your files to Tomcat
Once you have compiled your program we need to place the .class files in a directory so Tomcat knows about them.
This is why we had you package your program the way we did. Follow these steps:
create a directory called quotePackage in the samples directory of the WEB_INF soap directory.
eg. C:\Tomcat 5.5\webapps\soap\WEB-INF\classes\samples\
Inside this directory copy your .class files into it. Your directory might look like this now:
C:\Tomcat 5.5\webapps\soap\WEB-INF\classes\samples\quotePackage\
Stock.class
quoteServer.class
4. Start your Tomcat Server
This can be done by using the utility that came with Tomcat. (If your server is already started
you will need to stop and start it again)
5. Deploy your service
Now we actually deploy our service to Tomcat. This will tell Tomcat to run our service with the RPC-router
that we installed earlier. It then will be accessible by our clients
Prior to deployment you will need to use the Deployment Service Descriptor discussed in the client section.
We have provided you with deployment service descriptor here.
To deploy the project simply at a command prompt type:
java org.apache.soap.server.ServiceManagerClient http://localhost:8080/soap/servlet/rpcrouter deploy quoteServerDD.xml
6. Access via client
Your server has now been successfully deployed
Now you can try to access it via your client. To do this in the directory where you stored your
files run your java client:
eg. C:\...\samples\quotePackage\
java stockClient http://localhost:8080/soap/servlet/rpcrouter
Where stockClient is the name of your client and http://localhost:8080/soap/servlet/rpcrouter
is the url of your tomcat server that you tested earlier.