Development and Testing of Web Services with Axis2: A Practical Handbook

Dive into the world of web service development with Apache Axis2! Our comprehensive tutorial guides you step by step through the setup, development, and deployment of Axis2-based services. From system configuration to testing with SoapUI – let our practical guide accompany you and become an expert in creating web services with Java and Axis2.

Target Audience and Prerequisites

This tutorial is aimed at Java programmers who are interested in developing and deploying web services with Apache Axis2. To understand the tutorial smoothly, basic knowledge of Java, web services, XML, Ant, and application servers (Tomcat) is required.

Software and Tools Used

Before we begin, let’s take a look at the software and tools we need:

  • Java Development Kit (JDK) 1.6.0 (Tomcat 7 requires at least JDK 1.6)
  • Apache Ant 1.7.0 (Axis2 requires at least version 1.6.5)
  • Apache Axis2 1.5.4 (binary distribution)
  • Eclipse 3.6.1 IDE for project development (you can also use other IDEs, such as NetBeans)
  • Apache Tomcat 7.0.8
  • SoapUI for testing our web services
  • Mac OS X 10.6.4 (the guide was conducted on Mac OS but is also suitable for other operating systems. Some changes may be necessary when executing commands.)

System Setup

Before we can start development, we need to set up our system environment:

  1. Download the latest version of Apache Tomcat (currently version 7.0.8) and install it. Ensure that at least Java version 1.6 is installed on your system.
  2. Download the binary distribution of Apache Axis2 1.5.4 and extract it.
  3. Extract the Axis2 binary distribution zip file to any directory and run the command “ant create.war” in the axis2-1.5.4/webapp directory to create the axis2.war deployment in the axis2-1.5.4/dist directory.
  4. Deploy the axis2.war in the webapps directory of the Tomcat application server. You may need to restart the server if hot deployment is not supported.
  5. Check the successful deployment by navigating to https://localhost:8080/axis2/ and clicking on the validation link.

Creating an Axis2 Web Service

Now that our system environment is set up, we can start creating our Axis2 web service. Here are the steps we need to follow:

  1. Create a Java project (Axis2WSImplementation) with a class that will be exposed as a web service. In our example, two operations from the MyService class will be exposed.
  2. Create an Ant build.xml file that will be used to create aar, wsdl, and client-side stub and callback handler classes.
  3. Create a services.xml file that is part of the Axis2 archive and is placed in the META-INF folder of the Axis2 archive.

Deployment and Testing of the Axis2 Web Service

After we have created our Axis2 web service, we need to deploy and test it:

  • Copy the MyService.aar file to the directory ~apache-tomcat-7.0.8/webapps/axis2/WEB-INF/services.
  • Check the service deployment on the ListServices page (https://localhost:8080/axis2/services/listServices). MyService should be listed there with two operations.
  • Test the deployed service with SoapUI, one of the best tools for web service testing.

Summary and Outlook

In this tutorial, we provided a comprehensive overview of the development, deployment, and testing of web services with Apache Axis2. We covered the necessary steps from setting up the development environment to deployment and testing. Axis2 provides a powerful platform for creating web services and allows for easy integration into various application servers like Tomcat. We hope this tutorial has made it easier for you to get started in the world of Axis2 web services.

Create a Free Account

Register now and get access to our Cloud Services.

Posts you might be interested in:

centron Managed Cloud Hosting in Deutschland

Standardize Configuration File Names for Log4j

Apache, Guide
Standardize Configuration File Names for Log4j Log4j expects configuration files to have standard names. If your files are named differently, such as myapp-log4j.xml or myapp-log4j.properties, log4j will not recognize them…