Programming on the Web
 

Apache Axis Version 1.3


Following is a set of instruction for installing Apache Axis, registering a simple Calculator Web service, creating a WSDL description for the service, and developing a simple client that calls on the Calculator service.

  1. Installing Apache Axis on CDF
    • Download the file axis-1_3.tar and untar is in $CATALINA_HOME/webapps. You should see a directory called axis.
  2. Installing Apache Axis somewhere else
    • Download the file axis-1_3.tar and untar is in $CATALINA_HOME/webapps. You should see a directory called axis.
    • Download the file lib-1_3.tar, untar it, and copy its contents to $CATALINA_HOME/common/lib.
  3. Validate the Apache Axis installation
    • Start Tomcat
    • Point your browser to http://localhost:yourport/axis. You should see the Apache Axis welcome page. If this is not the case, make sure that Tomcat is in fact running and that you have added the axis directory under $CATALINA_HOME/webapps.
    • Click on Validation. Axis will then search for a set of needed and optional components. If any of the needed components is not found, make sure that the needed jar file is located at $CATALINA_HOME/common/lib.
  4. Install the Calculator Web service
    • Download the files Calculator.java and deploy.wsdd
    • Compile Calculator.java
    • Move the file Calculator.class to $CATALINA_HOME/webapps/axis/WEB-INF/classes
    • Add the various Apache Axis jar files to your CLASSPATH environment variable. On CDF you can do this by adding the following commands to your .cshrc file:

      setenv CLASSPATH {$CLASSPATH}:/u/csc309h/lib/tomcat-5.0.28/common/lib/axis.jar setenv CLASSPATH {$CLASSPATH}:/u/csc309h/lib/tomcat-5.0.28/common/lib/saaj.jar setenv CLASSPATH {$CLASSPATH}:/u/csc309h/lib/tomcat-5.0.28/common/lib/commons-discovery-0.2.jar setenv CLASSPATH {$CLASSPATH}:/u/csc309h/lib/tomcat-5.0.28/common/lib/commons-logging-1.0.4.jar setenv CLASSPATH {$CLASSPATH}:/u/csc309h/lib/tomcat-5.0.28/common/lib/jaxrpc.jar setenv CLASSPATH {$CLASSPATH}:/u/csc309h/lib/tomcat-5.0.28/common/lib/log4j-1.2.8.jar setenv CLASSPATH {$CLASSPATH}:/u/csc309h/lib/tomcat-5.0.28/common/lib/wsdl4j-1.5.1.jar

    • Deploy the Calculator service by calling:

      java org.apache.axis.client.AdminClient -pyourport deploy.wsdd

      Note: The above call requires Tomcat to be running.

    • Verify that the Calculator Web service has been successfully deployed by pointing your browser to http://localhost:yourport/axis/services/Calculator?wsdl. You should see the WSDL description of the Calculator service.
  5. Create a WSDL description for the Calculator Web service
    • cd to $CATALINA_HOME/webapps/axis/WEB-INF/classes
    • Call the Java2WSDL translator as follows (change the port to your assigned value):

      java org.apache.axis.wsdl.Java2WSDL -o calculator.wsdl -l "http://localhost:yourport/axis/services/Calculator" -n "urn:Calculator" Calculator

    • The above call will create the file calculator.wsdl in the current directory.
  6. Create a simple client.
    • Copy the file calculator.wsdl to the location where you would like to create the client application (e.g., ~/csc309/CalculatorClient). Note that the client application can be anywhere in your home directory and does not have to be under $CATALINA_HOME.
    • Use the WSDL2Java translator to create helper objects that will enable you to connect to the Calculator Web service by calling:
          java org.apache.axis.wsdl.WSDL2Java calculator.wsdl
      						
      The above call will create the Calculator_pkg directory, which should contain 4 Java files.

    • Compile all Java files in the Calculator_pkg directory.
    • Download and compile the file CalcClient.java