Technology weblog

Sunday Jan 07, 2007

Running Apache Axis samples

This post details how to get started with the samples that are shipped with Apache Axis 1.4.

First Tomcat needs to be installed. On a Gentoo Linux system, the Tomcat installation resides in /usr/share/tomcat-x.y, where in my case x=5 and y=5. Assuming that Apache Axis has been downloaded and unpacked, install Axis by

  1. Copying the axis directory in axis_1.4/webapps/axis (and its contents) to the webapps directory of the Tomcat installation, in my case (Gentoo Linux) /var/lib/tomcat-5.5/webapps
  2. Make sure the xercesImpl.jar, mail.jar and activation.jar files are on the classpath. You can test this by going to http://localhost:8080/axis/happyaxis.jsp. In my case, the Xerces XML parser could already be located. For the mail.jar and activation.jar I had to symlink /usr/share/sun-javamail-bin/lib/mail.jar and /usr/share/gnu-jaf-1/lib/activation.jar to /usr/share/tomcat-5.5/common/lib. Change this mutatis mutandum for your local server configuration.
Going back to the directory where Axis has been unpacked, go to the samples/echo directory and invoke ant.  According to the accompanying readme, a couple of steps must be performed
  • Set up your classpath:
    export CLASSPATH= \
    /usr/share/xerces-2/lib/xercesImpl.jar: \
    /usr/share/junit/lib/junit.jar: \
    /usr/share/gnu-jaf-1/lib/activation.jar: \
    for i in ../../lib/*.jar; do CLASSPATH=$CLASSPATH":"$i; done
  • Start Tomcat
    /etc/init.d/tomcat-5.5 start
  • Deploy the service
    java org.apache.axis.client.AdminClient deploy.wsdd
    Check that the service has successfully been deployed by going to the  list of deployed services http://localhost:8080/axis/servlet/AxisServlet

  • Run the sample client
    mkdir -p samples/echo
    mv *.class samples/echo
    java samples.echo.TestClient
This should give the following output
echoString                OK
echoStringArray           OK
echoInteger               OK
echoIntegerArray          OK
echoFloat                 OK
echoFloatArray            OK
echoStruct                OK
echoStructArray           OK
echoVoid                  OK
echoBase64                OK
echoHexBinary             OK
echoDate                  OK
echoDecimal               OK
echoBoolean               OK
echoMap                   OK
echoMapArray              OK
The same procedure may be followed for the other samples in the samples directory.


Post a Comment:
Comments are closed for this entry.

Hire us