Using Axis Web Services with JBoss

Apache Axis is an implementation of the SOAP (“Simple Object Access Protocol”). This project has been decommissioned in favor of Apache CXF, therefore it is highly recommended that you migrate your Axis Web services to Apache CXF.

If you need to use Axis Web services in a recent JBoss EAP / WildFly application, you should at least exclude the webservices subsystem in your jboss-deployment-structure.xml as follows:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
        <subsystem name="webservices"/>

This approach is however discouraged as the Axis libraries have not been tested with JDK 1.8 which is the bare minimal requirement to start WildFly / JBoss EAP 7.

As a reference, we include an Axis tutorial for JBoss 5.

Using Apache Axis with JBoss 5

Still not ready for JBoss WS ? if you don’t have a JDK 1.5 compliant environment then consider using Axis as your Web Service Engine. It’s robust, stable and easy to setup.

Axis is essentially a SOAP engine, that is a framework for constructing SOAP processors such as clients, servers, gateways, etc. The first thing to do is installing Axis engine on JBoss.

 Installing Axis on JBoss

At first download Axis from the Apache project:
Explode the zip folder. Now you need to deploy the Axis engine to JBoss Web Engine (Tomcat).
Here’s how to do it: rename the folder axis under AXIS_HOME/webapps to axis.war and copy the folder under “deploy” of your JBoss

Verify that Axis has been deployed correctly: http://localhost:8080/axis/


Publishing Web Services with Axis
Let’s say we have a simple class like the following:
package test;

public class HelloWorld {

  public String hello(String message) {

    return "Invoked with" +message;


How do we go about making this class available via SOAP? there are a couple of answers to that
question, but we’ll start with an easy solution.

At first compile the class :

javac -d .

Now copy the class under WEB-INF/classes of your axis.war

Ok, now the last step is registering your Web Service so that Axis is aware of it. A Web Service can be registered with a Deployment Descriptor (WSDD) file. A deployment descriptor contains a bunch of things you want to “deploy” into Axis – i.e. make available to the Axis engine.

Here’s a simple wsdd file for our WebService:


  <service name="HelloWorld" provider="java:RPC">
    <parameter name="className" value="test.HelloWorld"/>
    <parameter name="allowedMethods" value="*"/>

Pretty simple, really – the outermost element tells the engine that this is a WSDD deployment,and defines the “java” namespace. Then the service element actually defines the service for us. A service is a targeted chain which means it may have any of: a request flow, a provider, and a response flow.

In this case, our provider is “java:RPC”, which is built into Axis, and indicates a Java RPC service. We need to tell the RPCProvider that it should instantiate and call the correct class (e.g. test.HelloWorld), and another to tell the engine that any public method on that class may be called via SOAP (that’s what the “*” means)

Now save your wsdd file as deploy.wsdd and run the AdminClient which is an Utility to deploy the WebService:

java -classpath %AXIS_HOME%/lib/axis.jar;%AXIS_HOME%/lib/commons-discovery-0.2.jar;%AXIS_HOME%/lib/commons-logging-1.0.4.jar;%AXIS_HOME%/lib/saaj.jar;%AXIS_HOME%/lib/jaxrpc.jar org.apache.axis.client.AdminClient deploy.wsdd

If everything was Ok now you should see the WebService deployed on Axis: check the “List” option from the URL http://localhost:8080/axis/

The client

Let’s take a look at an example Web Service client that will call the hello method of the HelloWorld Web Service :

package test;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;

public class Client {

  public static void main (String args[]) {

    try {

      String url;


      Service service = new Service();

      Call call = (Call)service.createCall();

      call.setTargetEndpointAddress(new URL(url));

      call.setOperationName(new QName("HelloWorld", "hello"));

      Object[] params = new Object[1];

      params[0] = "Hello Message";

      Object result = call.invoke(params);

      System.out.println("result is " + result);


    catch(Exception e) {




In order to invoke our Web Service we use the Service and Call objects. These are the standard JAX-RPC objects that are used to store metadata about the service to invoke. With this we set up our endpoint URL – this is the destination for our SOAP message.
call.setTargetEndpointAddress(new URL(url));

With this we define the operation (method) name of the Web Service.

call.setOperationName(new QName("HelloWorld", "hello"));

Then we actually invoke the desired service, passing in an array of parameters – in this case just one String.

Object result = call.invoke(params);

Obtaining WSDL for deployed services

When you make a service available using Axis, there is typically a unique URL associated with that service. For our service it’s http://localhost:8080/axis/services/HelloWorld?wsdl
When you point your browser to that location, Axis will automatically generate a service description for the deployed service, and return it as XML in your browser :
<?xml version="1.0" encoding="UTF-8" ?>
 <wsdl:message name="helloRequest">
  <wsdl:part name="in0" type="xsd:string" />
 <wsdl:message name="helloResponse">
  <wsdl:part name="helloReturn" type="xsd:string" />
 <wsdl:portType name="HelloWorld">
  <wsdl:operation name="hello" parameterOrder="in0">
   <wsdl:input message="impl:helloRequest" name="helloRequest" />
   <wsdl:output message="impl:helloResponse"
    name="helloResponse" />
 <wsdl:binding name="HelloWorldSoapBinding" type="impl:HelloWorld">
  <wsdlsoap:binding style="rpc"
   transport="" />
  <wsdl:operation name="hello">
   <wsdlsoap:operation soapAction="" />
   <wsdl:input name="helloRequest">
     namespace="http://test" use="encoded" />
   <wsdl:output name="helloResponse">
     use="encoded" />
 <wsdl:service name="HelloWorldService">
  <wsdl:port binding="impl:HelloWorldSoapBinding"
    location="http://localhost:8080/axis/services/HelloWorld" />

Generating Java Classes from WSDL

Another approach is to generate Java Classes starting from WSDL contract. You can use the AdminClient to follow this approach:

java -classpath %AXIS_HOME%/lib/wsdl4j-1.5.1.jar;%AXIS_HOME%/lib/axis.jar;%AXIS_HOME%/lib/commons-discovery-0.2.jar;%AXIS_HOME%/lib/commons-logging-1.0.4.jar;%AXIS_HOME%/lib/saaj.jar;%AXIS_HOME%/lib/jaxrpc.jar org.apache.axis.wsdl.WSDL2Java http://localhost:8080/axis/services/HelloWorld?wsdl

This will generate the following classes under the service namespace which is localhost\axis\services\HelloWorld :

Generating Java Classes from the WSDL is defined as “top-down” approach, while generating WSDL from Java classes is called “bottom-up” style.

Although bottom-up Web service development may be faster and easier, especially if you are new to Web services, the top-down approach is the recommended way of creating a Web service. By creating the WSDL file first you will ultimately have more control over the Web service, and can eliminate interoperability issues that may arise when creating a Web service using the bottom-up method.