Home

Who are we

Articles

SOAP - A Quick Intro to Webservices

XML-RPC - A Five-Minute Tutorial

Installing Apache2 and mod_perl (Windows XP)

Links

Untitled Document

Getting Started with Java/Axis

So far our python and perl web services are running and our clients are well behaved when communicating with each other. This is not too big of a surprise, the languages being fairly similar. A topic we already discussed was perl and python being somewhat forgiving (from a coders point of view) when it comes to types. Java on the other hand is more demanding in that regard, so it's certainly interesting to see how that comes into play. And finally - I'd like to say that Java is one of the big players in the web services game so discussing web services without Java would certainly be lacking something.

Having said that I can't really get around to mention Microsoft as well. .Net offers great support for SOAP based web services. The reason I am not discussing them here (at least not in this version) is that Visual Studio is not freely available in contrast to the other languages discussed here and is somewhat pricey.

Installing Axis

The SOAP implementation used in the following is Apache Axis. Before being able to use the examples below you will probably need to download and install Axis. But please read through this section before downloading and installing anything.

To install Axis download the .zip file from the Axis web site or one of the mirrors, unzip it to your location of choice and update/set your classpath to find the .jar files (the part about updating and/or setting the classpath is not mandatory since we can set them by in a script at build time or execution time. Examples on how to do that are given in the next section).

Just a little warning here - placing the .jar files in the java default extension folder (../jdk/jre/lib/ext) can create problems with web applications since the web libraries use a separate class loader. So if e.g. axis.jar is put into the extension folder, it will be found there, but other libraries it depends on may be found in the web libraries. This can end in pretty difficult and hard to debug problems.

To install a web service using Axis, will will first need to install a web container. In this example I use Apache Tomcat. The installation of Tomcat is really straight forward - just download the windows installer and you should be set up. You may also want to set the CATALINA_HOME environmental variable to the folder Tomcat was installed in.

With Tomcat installed, copy the directory tree under the <axis>\webapps directory in the Axis distribution into the Tomcat webapps directory. You also will need to install additional libraries: Axis requires activation.jar from the JavaBeans Activation Framework. Download it and put it somewhere it can be found, e.g. in axis\WEB-INF\lib. You should not need an JAXP 1.1 XML compliant parser, but Axis recommends Apache Xerces. I downloaded Xerces jars and added them to the other jar file under axis\WEB-INF\lib. And finally Axis recommends using JavaMail and Apache XML Security to take care of soap attachments and security. Download both (if you wish to install that feature - it is not mandatory for axis to work) and and put the .jar files into axis\WEB-INF\lib. xmlsec is again one of the picky packages. It requires xalan.jar (and not just any version) - so get the the newest stable versions of xalan and xmlsec and cross your fingers that they match. It is really just necessary to get the xalan.jar file (try to avoid downloading the whole distribution since that can be quite large). You could also consider saving yourself the installation of JavaMail and xmlsec (and with that xalan) since we are not going to be using them in the following example, but you might get some warnings when installing services or running applications.

The axis distribution I installed (axis1.2.1) came with the SOAPMonitorApplet pre-compiled and deployed, but with the class files in the wrong location. To get the soap monitor running you will just need to copy the SOAPMonitor class files from axis\WEB-INF\classes to \axis as is explained in the description to compile and restart tomcat. However having the monitor running will not automatically monitor any service installed. For that the service has to be registered with the SOAPMonitor. Please consult the Axis documentation on how to do that.

And finally - when running the dateInfoServer service as intended reveals a bug in axis1.2.1 that creates an invalid xml file (duplicate attribute) when using an array type in the response. This is a know problem and has been fixed for later releases. I therefore downloaded release axis-bin-1.3.zip from the nightlies page. I hope that at the time you read this a new stable version of Axis has been made available that can be used.

So, as promised, a short list of things to do to get Axis installed and running can be found here.

Previous: SOAP RPC Server and Client in Python