Apache Axis


Table of contents



Conditions to create Axis Web Services

  • Linux platform
  • Java jdk 1.5
  • Apache Axis 1.3 [download]
  • Tomcat 5.5.9 (This tutorial assumes, that the Tomcat server runs on Port 8080.)


  • Install Apache Axis

    1) Download and unpack
    Download and unpack the Apache Axis library (.zip., .tgz).


    2) Stop the server
    Stop the the Tomcat server, if it runs:
    $tomcat-directory/bin> /bin/sh shutdown.sh


    3) Copy the directory
    Copy the directory 'webapps/axis' of the unpacked Axis library to the directory '$CATALINA_HOME/webapps' of the Tomcat server. Add the Axis data to the Tomcat file 'webapps'.

    There is a sub-directory 'WEB-INF' in the copied Axis directory. This sub-directory contains the configuration data and the Web Services.


    4) Set paths to the libraries
    To simplify matters copy all libraries to the Tomcat directory <webapps/axis/WEB-INF/lib> .
    Add the library-path to the CLASSPATH variable:

            export CLASSPATH=/commons-logging.jar
    	export CLASSPATH=/saaj.jar
    	export CLASSPATH=/axis-ant.jar
    	export CLASSPATH=/jaxrpc.jar
    	export CLASSPATH=/axis.jar
    	export CLASSPATH=/log4j-1.2.8.jar
    	export CLASSPATH=/commons-discovery.jar
    	export CLASSPATH=/wsdl4j.jar
       


    5) Start the Tomcat server

    $tomcat-verzeichnis/bin> /bin/sh startup.sh


    6) Axis startpage
    Login as Tomcat-Manager 'http://localhost:8080/manager/html'. There must be an axis directory. According to the requirements the classes can be reloaded. To navigate to the Axis startpage you can use the 'axis' link or type in the URL 'http://127.0.0.1:8080/axis/'.
    (Please note, that the port number may differ.)


    7) Test the Axis components (libraries)
    To test the complete configuration, navigate to the page 'http://localhost:8080/axis/happyaxis.jsp' or use the link 'Validate the local installation's configuration' . This HappyAxis-page validates the local installation's configuration. If any of the needed libraries are missing, Axis will not work. When all needed libraries (core components) can be found this validation page is happy.

    Some components:
    JavaBeans Activation Framework
    JavaMail

    Add the reloaded libraries to the CLASSPATH variable:

     
       export CLASSPATH=/activation.jar 
       export CLASSPATH=/mail.jar
       


    8) Show available services
    The link 'View the list of deployed Web services' navigates to the page 'http://localhost:8080/axis/servlet/AxisServlet', which shows all available Web Services.




    Creation of Web Services with the WSDL2Java parser

    The following steps show how services can be created:

    1) The WSDL file
    Copy the WSDL file (Web Service Definition Language) SemanticMediator.wsdl to the local directory.


    2) Create the client-side classes
    java org.apache.axis.wsdl.WSDL2Java SemanticMediator.wsdl
    The client-side classes (stubs and interfaces) are saved in the directory, specified by the namespace.


    3) Create the server-side classes
    java org.apache.axis.wsdl.WSDL2Java --server-side --skeletonDeploy true SemanticMediator.wsdl
    The optional setting 'skeletonDeploy true' causes the generation of skeleton classes for each in the header file defined method. The skeleton routines can be readily used to implement one or more of the remote methods in a new SOAP Web Service. The server-side classes (skeleton and service) are saved in the directory, specified by the namespace.


    4) Build a separate client
    The client class is not generated automatically. The following code shows how to call a method of a remote Web Service. The used method name is adjusted in the WSDL file.

             public class DialogClient {
    	       
    	     ...
    	     // Make a service
    	     SemanticMediator service = new SemanticMediatorLocator();
    
    	     // use the service to get a stub which implements the SDI
    	     ProcessData port = service.getSemanticMediator();
    
    	     Object o = port.processData(xmlDocument);
    	
    	      ...
    	 }
        


    5) Implement the service
    The service class SemanticMediatorSoapBindingImpl.java is created by the WSDL2Java parser. Now the body of the method 'processData' must be implemented.


    6) Deployment
    First compile all Java classes. Copy the created directory 'org/' with all class files to the Tomcat directory 'webapps/WEB-INF/classes/'. Furthermore reload the classes in the Tomcat-Manager.

    To provide the services the particular WSDD file (Web Service Deployment Descriptor) must be called. These WSDD files were also created and saved in the particular directory by the WSDL2Java tool.

    Deployment-command:
    > java org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService deploy.wsdd
    (Please note, that the port may differ.)


    7) Usage of the services
    Now several clients can call the available services.