Looking at the wire
The tcpmon utility is used to look at the HTTP communication between
the Axis client and server. In my first article about Axis I showed how it was
used, and how it worked. In order to use it you’ll have to direct your requests
from your client to another port, for example 8081. You then tell tcpmon
to listen to port 8081. It shows what comes in, and then redirects to the Axis
port, which is 8080 in a default Tomcat setup. We’ve already made a bat-file for
running tcpmon, so we simply issue: tcpmon 8081 localhost 8080
Here’s part of what you see when a request for the DVD titles come in (click
on the picture to see the whole screen):
A hint on restarting Axis
If you, for some reason, want to restart Axis you don’t have to restart
Tomcat. Here’s what you must do:
- in Tomcat’s conf/tomcat-users.xml file add a line like
this:
<user name="java" password="axis" roles="manager" />
- enter this URL in your browser:
http://localhost:8080/manager/reload?path=/axis When
you’re prompted for username and password then enter the values from the
users-file.
Where to go from here
In my next article I’ll look into some of the Axis features we haven’t
covered yet:
- the SoapMonitor, which resembles tcpmon but is sitting on
the server side
- the automatic code generation tools. They can take your service class (in
our case the DVDService class) and generate both client and server code
for you.
- session management, a feature we know from servlets
We’ll also look more into error handling and "Interoperability", which has to
do with what we must consider if different platforms and SOAP implementations
should be able to talk to each other.
Finally we’ll modify the Struts DVD browser application to use web
services.
Installation of the examples
In the resources section below you’ll find a link where you can download a
zip file with all the programs and files shown in this article. Here are some
tips on how to install the DVD web service:
|
File |
Purpose |
Comments |
|
dvds.xml |
Contains the data for the DVDs in the collection |
The DVDService class contains the location of this file.
Be sure to insert the correct location for your computer. |
|
setcp.bat |
Set up CLASSPATH |
Place it in WEB-INF |
|
adminclient.bat |
Run the Axis Admin Client |
etc. |
|
tcpmon.bat |
Run the Axis tcpmon utility |
etc. |
|
deploy.wsdd |
Deploy DVDService |
etc. |
|
undeploy.wsdd |
Undeploy DVDService |
etc. |
|
*.java and *.class |
Java programs |
Place in WEB-INF/classes/hansen/playground |
All files, except the dvds.xml file, must be placed in Tomcat’s
webapps/axis directory.
The DVDManager class uses the JDOM
package. You must therefore have downloaded JDOM and placed the jdom.jar
file in Tomcat’s common/lib directory. The setcp.bat file contains the
location of the jdom.jar file.
All examples have been developed using JDK 1.4, and please note, that the
DVDClient uses features from this JDK, which are not present in prior
versions of the JDK.
Resources
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.
|