July 3, 2020
Hot Topics:

Developing Java Web Services with AXIS

  • By Usman Saleem
  • Send Email »
  • More Articles »

Apache Axis has made developing Java Web services a breeze. In this article, I will discuss some guidelines that prove to be very helpful when developing Java Web services using Axis. This article discusses the customization of Axis and the deployment of Web services; it does not discuss the theory of Web services, XML, Java, and so forth.

What Is Apache Axis?

The definition from Axis' Web site http://ws.apache.org/axis/: "Apache Axis is an implementation of the SOAP ("Simple Object Access Protocol") submission to W3C."

For me, the more suitable definition is: "Axis turns Java code into Web services."

Downloading Axis (Java)

Download the latest version of Axis (Java) from their Web site, http://ws.apache.org/axis. At the time of this writing, 1.1 is the stable release and 1.2 is in the alpha release. These guidelines are based in Axis 1.1. I will refer to this download as the Axis archive from this point onwards.

Customizing Axis

The following steps discuss how to customize Axis for your Web applications.

Step 1: Customizing web application

You can start with a new or existing standard Java-based Web application, also known as Web Application Archive or WAR. I assume that you know how to build a WAR file and what its contents are.

To enable a Web application to expose Web services, you need to customize the Web application so that it can use Axis engine. You need to perform three steps:

  1. Customize WEB-INF/web.xml.
  2. Add the Axis libraries into the WEB-INF/lib folder.
  3. Create a server-config.wsdd file.

If you are developing a new Web application, the quickest way to customize is to copy the axis folder from the Axis archive's webapps folder and rename it to your own Web application. You can safely delete the samples folder inside the classes folder of your new Web application. You may rename the index.html to your liking, say testaxis.html. It can help you later on to test the axis engine.

If you already have a Web application, you need to copy all the servlet mappings from the axis/WEB-INF/web.xml of the Axis archive into your Web application's web.xml file. You also need to copy all jar files from the axis/WEB-INF/lib folder to your Web application's lib folder. If you want to test your Web application later on, at least copy index.html and happyaxis.jsp from the axis folder to the root of your Web application. You can rename index.html to your liking, say testaxis.html.

Now that you have completed Steps 1 and 2 of customization, the third important step is to create the WEB-INF/server-config.wsdd file. The wsdd stands for Web service description file. It is an XML file used by the Axis engine. It contains definitions of the Web services that Axis deploys from your Web application.

The minimal contents of server-config.wsdd file are as follows:

<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
  <parameter name="adminPassword" value="admin"/>
  <parameter name="attachments.Directory" value="./attachments"/>
  <parameter name="attachments.implementation"
  <parameter name="sendXsiTypes" value="true"/>
  <parameter name="sendMultiRefs" value="true"/>
  <parameter name="sendXMLDeclaration" value="true"/>
  <parameter name="axis.sendMinimizedElements" value="true"/>
   <handler type="java:org.apache.axis.handlers.JWSHandler">
    <parameter name="scope" value="session"/>
   <handler type="java:org.apache.axis.handlers.JWSHandler">
    <parameter name="scope" value="request"/>
    <parameter name="extension" value=".jwr"/>
 <handler name="LocalResponder"
 <handler name="URLMapper"
 <handler name="Authenticate"
 <service name="AdminService" provider="java:MSG">
  <parameter name="allowedMethods" value="AdminService"/>
  <parameter name="enableRemoteAdmin" value="false"/>
  <parameter name="className" value="org.apache.axis.utils.Admin"/>
 <service name="Version" provider="java:RPC">
  <parameter name="allowedMethods" value="getVersion"/>
  <parameter name="className" value="org.apache.axis.Version"/>
<transport name="http">
   <handler type="URLMapper"/>
   <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
 <transport name="local">
   <handler type="LocalResponder"/>

Step 2: Test the Axis engine

If you have copied the index.html and happyaxis.jsp files and axis folder to your Web application, you can use index.html (or whatever you have renamed it) to test the Axis engine. Deploy your Web application in your favorite application server and access the above-mentioned test file. Click Validate to validate the Axis and View to view the deployed Web services. Everything should go fine by now!

Page 1 of 2

This article was originally published on December 6, 2004

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date