Tutorial

AXIS2 Web Services Tutorial

Published on August 4, 2022
AXIS2 Web Services Tutorial

Welcome to Apache Axis2 Tutorial. Recently I was trying to upgrade my Apache Axis2 skills from 1.3 to latest version 1.5.4 and I was not able to find out any tutorial that is self-explanatory and covering the latest release. So it forms the basis of my post for Axis2 Web Services Tutorial.

Apache Axis2 Tutorial

apache axis2 tutorial

Who Should use this Tutorial?

This tutorial is intended for Java programmers who are interested in developing and deploying Web Services using Apache Axis2.

Prerequisites

The scope of this tutorial is to use Axis2 for creating web services and invoking the web service using a Java client program and testing web service using Soap UI tool. Basic understanding of Java, Web Services, XML, Ant, and application server (Tomcat) is required to understand the tutorial with ease.

Software and Tools Used

  1. Java Development Kit (JDK) 1.6.0 (Tomcat 7 requires min JDK 1.6)
  2. Apache Ant 1.7.0 (Axis2 requires minimum version 1.6.5)
  3. Apache Axis2 1.5.4 (Binary Distribution)
  4. Eclipse 3.6.1 IDE for Project Development (You can use other IDE also, for example NetBeans)
  5. Apache Tomcat 7.0.8
  6. SoapUI for testing our web service.
  7. Mac OS X 10.6.4 (I am working on Mac OS but the tutorial should work for other operating systems also, however some change might be needed in executing the commands)

System Setup

  1. Download the latest version of Apache Tomcat latest version. As of now, the latest version is 7.0.8 and that is what I am using for this tutorial. It requires minimum Java Version 1.6, so make sure it’s installed in your system. If Java 6 is not installed in your system, you should download and install it first from Java SE Downloads. Download the Tomcat Core zip (apache-tomcat-7.0.8.zip) and unzip it to install it on your system. Set the JAVA_HOME environment variable to start and stop the server.

  2. Download Apache Axis2 1.5.4 Binary Distribution zip from Apache Axis2 – Releases. This step is required to create axis2.war that will be deployed to tomcat and to get the axis2 libraries to be used in projects.

  3. Unzip the Axis2 binary distribution zip into any convenient directory. Go to axis2-1.5.4/webapp directory and run the “ant create.war” command to create the axis2.war deployment in the axis2-1.5.4/dist directory. If you don’t have Apache Ant installed, you can download and install it from Apache Ant – Binary Distributions. Please note that I was facing some issue with axis2.war downloaded from War Distribution. Later on, I found out that few jars are missing in the axis2 War Distribution. War Distribution contains only 58 jars whereas Binary Distribution contains 63 jars. (I am feeling lazy to find out, which jars are missing.)

    $ ant create.war
    Buildfile: build.xml
    
    init:
        [mkdir] Created dir: /Users/pankaj/Downloads/axis2-1.5.4/dist/temp
         [copy] Copying 59 files to /Users/pankaj/Downloads/axis2-1.5.4/dist/temp
    
    prepare.repo:
         [copy] Copying 9 files to /Users/pankaj/Downloads/axis2-1.5.4/dist/temp/WEB-INF
        [mkdir] Created dir: /Users/pankaj/Downloads/axis2-1.5.4/dist/temp/WEB-INF/conf
         [copy] Copying 1 file to /Users/pankaj/Downloads/axis2-1.5.4/dist/temp/WEB-INF/conf
    
    create.war:
          [war] Building war: /Users/pankaj/Downloads/axis2-1.5.4/dist/axis2.war
       [delete] Deleting directory /Users/pankaj/Downloads/axis2-1.5.4/dist/temp
    
    BUILD SUCCESSFUL
    Total time: 2 seconds
    
  4. Deploy the axis2.war in the tomcat application server by copying it in tomcat webapps directory. You may need to restart the server if it’s not supporting hot deployment.

  5. Go to https://localhost:8080/axis2/ and click on Validate link. If the Happy Axis page is coming with GREEN color then it means that axis2 is successfully deployed. Our system setup is ready now and we can proceed for creating Axis2 web services.

axis2 tutorial

Creating Axis2 Web Service

For creating Axis2 Web Service archive, we need following:

  1. A Java Project (Axis2WSImplementation) with a class that will be exposed as a web service. In my example, I am exposing two operations from MyService class. The first operation getData input is String and returns String whereas the second operation getObjectData input is MyBean java object and returns MyBean java object after some data manipulation. Note that MyBean class implements Serializable interface so that it can be transferred over the network.
  2. Ant build.xml file that will be used to create aar, wsdl and client side stub and callback handler classes.
  3. services.xml file that will be part of the axis2 archive. This file will be put in the META-INF folder of the axis2 archive.

The project structure will look like the below image. apache axis2 project Don’t get confused with the content inside build folder. They will be created when we will execute the build.xml ant file.

Axis2 Web Service Project Explanation

MyService.java: Implementation class that will be exposed as Axis2 web service.

package com.journaldev.ws;

import com.journaldev.bean.MyBean;

public class MyService {

	public String getData(String input) {
		return "Hi" + input;
	}

	public MyBean getObjectData(MyBean myBean) {

		String name = myBean.getName();
		int id = myBean.getId();
		myBean.setId(id + 100);
		myBean.setName("Output: " + name);

		return myBean;
	}
}

MyBean.java: Java Bean class that is input and output of getObjectData operation in web service.

package com.journaldev.bean;

import java.io.Serializable;

public class MyBean implements Serializable {

	private static final long serialVersionUID = -1129402159048345204L;

	private String name;

	private int id;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

}

services.xml: Axis2 web service related parameters are part of this xml file. ServiceClass parameter specifies the class that will be exposed as web service. The other important parameters are targetNamespace and schemaNamespace. services.xml

<service name="MyService" scope="application" targetNamespace="https://journaldev.com/">
 <description>
 MyService
 </description>
 <messageReceivers>
 <messageReceiver mep="https://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
 <messageReceiver mep="https://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
 </messageReceivers>
 <schema schemaNamespace="https://journaldev.com/xsd"/>
 <parameter name="ServiceClass">com.journaldev.ws.MyService</parameter>
</service>

build.xml: Ant build file for performing Axis2 tasks. There are three targets defined whose details are:

  1. generate.wsdl: This target generates the MyService.wsdl file in the build folder. Make sure that targetNamespace and schemaTargetNamespace is same as in service.xml file.
  2. generate.service: This target generates axis2 archive in the build folder. It includes the services.xml file in the archive and archive name is MyService.aar
  3. generate.client: This target generates the client side classes. Make sure you run this after executing generate.wsdl so the MyService.wsdl file is present in the build folder.

build.xml

<project name="AxisWSImplementation" basedir="." default="generate.service">

 <property environment="env"/>
 <property name="build.dir" value="build"/>

 <path id="axis2.classpath">
 <fileset dir="${basedir}/lib">
 <include name="*.jar"/>
 </fileset>
 </path>

 <target name="compile.service">
 <mkdir dir="${build.dir}"/>
 <mkdir dir="${build.dir}/classes"/>
 <mkdir dir="${build.dir}/resources"/>
 <!--First let's compile the classes-->
 <javac debug="on"
 fork="true"
 destdir="${build.dir}/classes"
 srcdir="${basedir}/src"
 classpathref="axis2.classpath">
 </javac>
 </target>

 <target name="generate.wsdl" depends="compile.service">
 <taskdef name="java2wsdl"
 classname="org.apache.ws.java2wsdl.Java2WSDLTask"
 classpathref="axis2.classpath"/>
 <java2wsdl className="com.journaldev.ws.MyService"
 outputLocation="${build.dir}"
 targetNamespace="https://journaldev.com/"
 schemaTargetNamespace="https://journaldev.com/xsd">
 <classpath>
 <pathelement path="${axis2.classpath}"/>
 <pathelement location="${build.dir}/classes"/>
 </classpath>
 </java2wsdl>
 </target>

 <target name="generate.service" depends="compile.service">
 <copy toDir="${build.dir}/classes" failonerror="false">
 <fileset dir="${basedir}/resources">
 <include name="**/*.xml"/>
 </fileset>
 </copy>
 <jar destfile="${build.dir}/MyService.aar">
 <fileset excludes="**/Test.class" dir="${build.dir}/classes"/>
 </jar>
 </target>

 <target name="generate.client" depends="compile.service">
 <taskdef name="wsdl2java"
 classname="org.apache.axis2.tool.ant.AntCodegenTask"
 classpathref="axis2.classpath"/>
 <wsdl2java
 wsdlfilename="${build.dir}/MyService.wsdl"
 output="${build.dir}/resources" />
 </target>

 <target name="clean">
 <delete dir="${build.dir}"/>
 </target>
</project>

Generating WSDL, Axis Archive and Stub Files

  • Execute generate.wsdl ant target to generate MyService.wsdl file.
  • Execute generate.service ant target to generate the MyService.aar file.
  • Execute generate.client ant target to generate the Stub classes.

Axis2 Web Service Deployment

Copy the MyService.aar in ~apache-tomcat-7.0.8/webapps/axis2/WEB-INF/services directory. Axis2 supports hot deployment of services, so you don’t need to restart the server. Check your service deployment on ListServices page (https://localhost:8080/axis2/services/listServices). MyService should be listed there with two operations. axis2 list services page

Axis2 Web Service Testing

After deploying the service, first of all we need to test it. Here I am using SoapUI that is one of the best tools for Web Service Testing. If you don’t have it, you can download it from their website and install it easily. Steps for Testing using SoapUI

  1. Create a new SoapUI project with Project Name MyServiceTest (you can give any name you want) and Initial WSDL/WADL https://localhost:8080/axis2/services/MyService?wsdl (You can get this URL from Axis2 List Services page after clicking on the MyService link.). Leave other options with default value and click on OK button to create the SoapUI testing project.
  2. Take any of the Soap Bindings and double click on the getData and getObjectData SOAP Requests.
  3. Provide some values for input in the request and submit it to the web service end point URL. You should get output from the service similar to the below image. It confirms that our web service is up and running.

Axis2 Web service testing using SoapUI Now we will proceed with the last task of invoking the web service using Axis2 stub classes.

Axis2 Web Service invocation using Stub Files

  1. Create a Java Project Axis2Client in Eclipse.
  2. Create lib folder and copy all the Axis2 jars from downloaded binary distribution lib folder. Add these jars to the build path of the project.
  3. Copy earlier generated MyServiceStub.java and MyServiceCallbackHandler.java in the project src with correct package structure. In my case I copied them in com.journaldev package. If you have to provide these classes to somebody else, I would strongly suggest creating a jar from them and then distributing it with others to avoid any modifications.
  4. Create the Axis2ClientUsingStubsFromAnt client class to invoke the web service operations. The project structure will look similar like below image.

axis2 tutorial project Axis2ClientUsingStubsFromAnt Code

package com.journaldev.ws.client;

import java.rmi.RemoteException;

import com.journaldev.MyServiceStub;
import com.journaldev.MyServiceStub.GetData;
import com.journaldev.MyServiceStub.GetDataResponse;
import com.journaldev.MyServiceStub.GetObjectData;
import com.journaldev.MyServiceStub.GetObjectDataResponse;
import com.journaldev.MyServiceStub.MyBean;

/**
 *
 * @author Pankaj - www.journaldev.com This class will invoke Axis2 web service
 *         operations using Stub classes
 *
 */
public class Axis2ClientUsingStubsFromAnt {

	/**
	 * END_POINT is the web service endpoint
	 */
	private final static String END_POINT = "https://localhost:8080/axis2/services/MyService";

	public static void main(String[] args) throws RemoteException {
		System.out.println("START");

		// Create the Stub Object by passing the Web Service Endpoint URL
		MyServiceStub stub = new MyServiceStub(END_POINT);

		// Creating an input object for the getData operation
		GetData getDataInput = new GetData();

		// Setting the input part in the getData input object
		getDataInput.setInput("PANKAJ");

		// invoking the getData operation
		GetDataResponse getDataOutput = stub.getData(getDataInput);

		// get_return method returns the web service output object. Here its
		// String, so we can
		// directly print the returned value
		System.out.println("Output:" + getDataOutput.get_return());

		// Creating input object for the getObjectData operation
		GetObjectData getObjectDataInput = new GetObjectData();
		MyBean myBean = new MyBean();
		myBean.setId(1);
		myBean.setName("KUMAR");

		// Setting the input part in the getObjectData input object
		getObjectDataInput.setMyBean(myBean);

		// invoking the getObjectData operation
		GetObjectDataResponse getObjectDataOutput = stub
				.getObjectData(getObjectDataInput);

		// Get the MyBean object from the response object
		MyBean myBeanOutput = getObjectDataOutput.get_return();

		// Print the myBeanOutput values to check that web service operations
		// are getting invoked
		System.out.println("ID:" + myBeanOutput.getId() + "NAME:"
				+ myBeanOutput.getName());

		System.out.println("DONE");

	}

}

Execute the Axis2ClientUsingStubsFromAnt class to invoke the web service. Output of the above program is:

START
log4j:WARN No appenders could be found for logger (org.apache.axis2.description.AxisService).
log4j:WARN Please initialize the log4j system properly.
Output:HiPANKAJ
ID:101NAME:Output: KUMAR
DONE

If you find the tutorial helpful in understanding Axis2 and getting started with it, please share your thoughts in the comment section. And yeah, don’t forget to share it across with others. Your two clicks and 5 seconds time can help someone else to learn Axis2 easily. :)

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author(s)

Pankaj Kumar
Pankaj Kumar
See author profile
Category:
Tutorial

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
JournalDev
DigitalOcean Employee
DigitalOcean Employee badge
April 25, 2011

Great article. Thanks!

- F4

    JournalDev
    DigitalOcean Employee
    DigitalOcean Employee badge
    July 31, 2011

    Hi, I got the following error: sam@sam-PC /cygdrive/c/work/ixsystems-workspace/Axis2WSImplementation/resources $ ant generate.wsdl Buildfile: C:\work\ixsystems-workspace\Axis2WSImplementation\resources\build.xml compile.service: [javac] C:\work\ixsystems-workspace\Axis2WSImplementation\resources\build.xml:21: warning: ‘includeantruntime’ was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds BUILD FAILED C:\work\ixsystems-workspace\Axis2WSImplementation\resources\build.xml:21: srcdir “C:\work\ixsystems-workspace\Axis2WSImplementation\resources\src” does not exist! Total time: 0 seconds I think it is my project setup having some problem. Can you please pinpoint what is it? Thanks Sam

    - Sam

      JournalDev
      DigitalOcean Employee
      DigitalOcean Employee badge
      July 31, 2011

      Now I got the following error: BUILD FAILED C:\work\ixsystems-workspace\Axis2WSImplementation\build.xml:28: taskdef class org.apache.ws.java2wsdl.Java2WSDLTask cannot be found using the classloader AntClassLoader[] Total time: 0 seconds

      - Sam

      JournalDev
      DigitalOcean Employee
      DigitalOcean Employee badge
      August 3, 2011

      It seems to be an issue with your Classpath settings, please check your environment variables and make sure that required classes are present.

      - Pankaj

        JournalDev
        DigitalOcean Employee
        DigitalOcean Employee badge
        October 5, 2011

        Suppose I have a class say MyBanSubClass that extends MyBean and I want to send it to the getObjectData() service function . But the issue I am facing is i dont see the MyBanSubClass in the generated WSDL. So is it that whatever is exposed in Service only that is generated or shown as part of WSDL ? If yes then how should I make MyBanSubClass visible to the client?

        - chatting_enabled

          JournalDev
          DigitalOcean Employee
          DigitalOcean Employee badge
          October 9, 2012

          Hello, Do we need to run the Axis2ClientUsingStubsFromAnt as JAVA APPLICATION?

          - Sushil

          JournalDev
          DigitalOcean Employee
          DigitalOcean Employee badge
          October 17, 2012

          Yes, run it as java program.

          - Pankaj

            JournalDev
            DigitalOcean Employee
            DigitalOcean Employee badge
            October 18, 2012

            Really good tutorial! Do you have any other ones?

            - John Holland

            JournalDev
            DigitalOcean Employee
            DigitalOcean Employee badge
            October 19, 2012

            Let me know which tutorial you want.

            - Pankaj

              JournalDev
              DigitalOcean Employee
              DigitalOcean Employee badge
              October 25, 2012

              Hey Pankaj… Really nice article… Do you have any material on maven?

              - Shiva

              JournalDev
              DigitalOcean Employee
              DigitalOcean Employee badge
              October 25, 2012

              I am writing a tutorial on maven, will be up in few days. :)

              - Pankaj

              JournalDev
              DigitalOcean Employee
              DigitalOcean Employee badge
              July 26, 2013

              Could you please let me know if we have mavenized axis2 sample webservice in place, If yes please share the steps to do that. Thanks in advance

              - rakesh

                JournalDev
                DigitalOcean Employee
                DigitalOcean Employee badge
                January 8, 2013

                Nice article Pankaj. This should be added to the Axis2 site.

                - Dennis

                JournalDev
                DigitalOcean Employee
                DigitalOcean Employee badge
                January 8, 2013

                Thanks for such a nice compliment, I appreciate it but adding it to Axis2 articles list is not in my hand.

                - Pankaj

                  JournalDev
                  DigitalOcean Employee
                  DigitalOcean Employee badge
                  April 9, 2013

                  Nice article! I have question regarding defining occurances(minOccurs and maxOccurs) for elements (name, id in your example). I was able to set maxOccurs to unbounded by making it an array but no idea how to limit to some numbers. Also, whats the way to set nillable=false for elements. Thanks, Swarndeep

                  - Swarndeep Singh Tomar

                    JournalDev
                    DigitalOcean Employee
                    DigitalOcean Employee badge
                    April 12, 2013

                    Nice article! I have question regarding defining occurances(minOccurs and maxOccurs) for elements (name, id in your example). I was able to set maxOccurs to unbounded by making it an array but no idea how to limit to some numbers. Also, whats the way to set nillable=false for elements. I found that @XmlElement(required=true) seems not to work with axis2. Is that correct? Thanks, Swarndeep

                    - Swarndeep Singh Tomar

                      JournalDev
                      DigitalOcean Employee
                      DigitalOcean Employee badge
                      May 15, 2013

                      Dear Pankaj, thanks for the wonderful article. I am getting an exception when I run the client code. Its an org.apache.axis2.databinding.ADBException: Unexpected subelement. I also tried the example using a simple data type (String) instead of a complex one (object), and it worked fine. I am not sure why it doesn’t work in the case of an object (bean). One more thing… I used the CodeGen Axis 2 wizard to produce the WSDL and the Java Stubs from the WSDL. Would that be a problem in any way? Many thanks for your help. Cheers !

                      - Mandeep Singh

                        JournalDev
                        DigitalOcean Employee
                        DigitalOcean Employee badge
                        June 20, 2013

                        Hi pankaj, I did my self with your steps.but i am unable to create generate.wsd and generate.service.when i run the ant file in command prompt.my project shows the build folder,but it didn’t having this two files.kindly help me.

                        - Kader

                          JournalDev
                          DigitalOcean Employee
                          DigitalOcean Employee badge
                          September 12, 2013

                          hey i am acing problem in creating stub using https protocol. help me !!

                          - vishal

                            JournalDev
                            DigitalOcean Employee
                            DigitalOcean Employee badge
                            November 22, 2013

                            I am a newbie to java web services. I prepared a .aar file and deploying it in tomcat5.5.35 with axis2. Now while running the web service I found a weird error org.apache.axis2.dataretrieval.DataRetrievalException: Failed to load from file, META-INF/ServiceData.xml I cannot figure out the reason behind it. My .aar file contains a services.xml listing the services. But why axis is trying to load that ServiceData.xml file. I am using jdk1.6 and tomcat5.5 with axis2. The complete error log is given below org.apache.axis2.dataretrieval.DataRetrievalException: Failed to load from file, META-INF/ServiceData.xml at org.apache.axis2.dataretrieval.DataRetrievalUtil.buildOM(DataRetrievalUtil.java:64) at org.apache.axis2.dataretrieval.AxisDataLocatorImpl.loadServiceData(AxisDataLocatorImpl.java:103) at org.apache.axis2.description.AxisService.getDefaultDataLocator(AxisService.java:2281) at org.apache.axis2.description.AxisService.getDataLocator(AxisService.java:2265) at org.apache.axis2.description.AxisService.getData(AxisService.java:2184) at org.apache.axis2.description.AxisService.getWSDL(AxisService.java:1139) at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1077) at org.apache.axis2.transport.http.ListingAgent.processListService(ListingAgent.java:280) at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:229) at javax.servlet.http.HttpServlet.service(HttpServlet.java:627) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:843) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:679) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1303) at java.lang.Thread.run(Thread.java:662) Caused by: javax.xml.stream.XMLStreamException: File does not exist in the Service Repository! File=META-INF/ServiceData.xml at org.apache.axis2.dataretrieval.DataRetrievalUtil.getInputStream(DataRetrievalUtil.java:103) at org.apache.axis2.dataretrieval.DataRetrievalUtil.buildOM(DataRetrievalUtil.java:60) … 22 more 16:20:23,031 DEBUG StAXUtils:263 - XMLStreamReader is org.apache.axiom.util.stax.dialect.WoodstoxStreamReaderWrapper 16:20:23,046 DEBUG StAXUtils:263 - XMLStreamReader is org.apache.axiom.util.stax.dialect.WoodstoxStreamReaderWrapper 16:20:23,046 DEBUG StAXUtils:680 - About to create XMLOutputFactory implementation with classloader=WebappClassLoader delegate: false repositories: /WEB-INF/classes/ ----------> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@4aa0ce

                            - Anjan

                              JournalDev
                              DigitalOcean Employee
                              DigitalOcean Employee badge
                              December 20, 2013

                              I created one axis2 webservice through eclipse IDE, and created axis2 client side code. But while invoking the service from client stub, I am unable to find a method response.get_return(). Please any one can help me out from this issue.

                              - Sai

                                JournalDev
                                DigitalOcean Employee
                                DigitalOcean Employee badge
                                January 22, 2014

                                hey pankaj , do we need dynamic web application project to create the web service or normal java project please breaf it am new to web service pls

                                - sudarshan

                                JournalDev
                                DigitalOcean Employee
                                DigitalOcean Employee badge
                                January 22, 2014

                                Hi Sudarshan, Creating a dynamic web application helps in packaging it as WAR file. You can go with normal java project also, then convert it to Maven WAR project to achieve the same thing.

                                - Pankaj

                                  JournalDev
                                  DigitalOcean Employee
                                  DigitalOcean Employee badge
                                  February 22, 2014

                                  sorry to say but article is not organized properly. We can not just simply rely steps mentioned to execute successfully.

                                  - swapnil

                                    JournalDev
                                    DigitalOcean Employee
                                    DigitalOcean Employee badge
                                    June 9, 2014

                                    Dear Pankaj, Even after a couple of years later, I can say that your tuto is very clear, well organized. And the use of eclipse helps a lot to dive immediately into the real world. For those who likes command lines here some links from Axis2 web page: Axis2 Quick Start Guide and Apache Axis2 User’s Guide -Building Services and finally Apache Axis2 Advanced User’s Guide. Hope that could help some else. Cheers,

                                    - Rob Erto

                                      JournalDev
                                      DigitalOcean Employee
                                      DigitalOcean Employee badge
                                      June 16, 2014

                                      Hi, When I use the this JAVA2WSDL as plugin in maven it generating WSDL with the following end point url… https://localhost:8080/axis2/services/MyService. Once the wsdl got generated I need to manully open the wsdl and edit the END point url…like below https://localhost:8080/TestService/services/MyService TestService is my web service. Please help to me out…

                                      - Manikandan B

                                        JournalDev
                                        DigitalOcean Employee
                                        DigitalOcean Employee badge
                                        October 30, 2014

                                        Hi Pankaj, Nice article. Is any article available to use Axis2/C in objective C for Mac OS X app for creating client app? First of all, is it possible? Thanks in advance, Kranti

                                        - Kranti

                                          JournalDev
                                          DigitalOcean Employee
                                          DigitalOcean Employee badge
                                          June 20, 2015

                                          Dear sir can u send me i want an example on axis2 with maven step to step… and more post on maven tutorial

                                          - subrat

                                            JournalDev
                                            DigitalOcean Employee
                                            DigitalOcean Employee badge
                                            September 6, 2015

                                            Dear Pankaj, I have been using your website as a reference, whenever I need any help on java and related technologies. I have found your articles to be in depth and up to date. Keep up the good work and I wish you all the best in your mission. regards, Darshan

                                            - Darshan

                                              JournalDev
                                              DigitalOcean Employee
                                              DigitalOcean Employee badge
                                              January 20, 2016

                                              Hi Pankaj as of now i’m using to convert java classes into .wsdl files… which is working great…but there is requirement… that i need to convert the java files into wadl files… is axis supports that… if so can you give me small example on it using ant… build.xml… thank you

                                              - Suresh

                                              JournalDev
                                              DigitalOcean Employee
                                              DigitalOcean Employee badge
                                              January 16, 2018

                                              I am sure that JAX-WS and axis2 implementation doesn’t support wadl. But if axis2 supports restful then you can do that but not for WebService. Only for restful services. Its’ better you go with JAX-WS specification.

                                              - Srikanta

                                                JournalDev
                                                DigitalOcean Employee
                                                DigitalOcean Employee badge
                                                March 2, 2016

                                                Hello all, i am getting the below error when i am starting the tomcat server, can someone help on it. “[ERROR] The MyService.aar service, which is not valid, caused The services.xml file cannot be found for the service: C:\apache-tomcat-7.0.68\webapps\axis2\WEB-INF\services\MyService.aar” Thanks in advance, Dinesh.

                                                - dinesh

                                                  JournalDev
                                                  DigitalOcean Employee
                                                  DigitalOcean Employee badge
                                                  July 19, 2016

                                                  Hi Pankaj, Do you have tutorial on SOAP webservices? with examples.

                                                  - Jayanti Rode

                                                    JournalDev
                                                    DigitalOcean Employee
                                                    DigitalOcean Employee badge
                                                    August 11, 2016

                                                    Hye Pankash, Thank you for your great tutorial. Do you have any tutorial regarding how to get raw request XML made by client? I create my web services using Axis2 and now I am stuck and dont know how to get and put in log file the request XML made by client -Miss Suri

                                                    - Suri

                                                      JournalDev
                                                      DigitalOcean Employee
                                                      DigitalOcean Employee badge
                                                      July 8, 2017

                                                      After run https://localhost:8080/axis2/services/ it displays only: Deployed services Version Available operations getVersion not completed web service in win7

                                                      - Shilendra

                                                        JournalDev
                                                        DigitalOcean Employee
                                                        DigitalOcean Employee badge
                                                        November 3, 2017

                                                        you don’t reply to problem, but only to compliments… getting issue as below: \build.xml:33: java.lang.RuntimeException: java.lang.ClassCastException: org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver cannot be cast to org.apache.axis2.engine.MessageReceiver at org.apache.ws.java2wsdl.Java2WSDLBuilder.(Java2WSDLBuilder.java:109)

                                                        - Jiten

                                                        JournalDev
                                                        DigitalOcean Employee
                                                        DigitalOcean Employee badge
                                                        November 3, 2017

                                                        I am not sure what is the issue you are facing. This article I wrote more than 5 years back, I haven’t used Axis-2 in last 4 years. So I can’t help you in this issue.

                                                        - Pankaj

                                                          JournalDev
                                                          DigitalOcean Employee
                                                          DigitalOcean Employee badge
                                                          September 12, 2018

                                                          this can be implemente in windows ?

                                                          - joshua

                                                            JournalDev
                                                            DigitalOcean Employee
                                                            DigitalOcean Employee badge
                                                            April 8, 2019

                                                            Thank you sir, your article is still helpful in 2019 :D

                                                            - Zakaria Kaoukab

                                                              JournalDev
                                                              DigitalOcean Employee
                                                              DigitalOcean Employee badge
                                                              April 11, 2019

                                                              Hi Pankaj, Please share link for source code of import com.journaldev.MyServiceStub; and import com.journaldev.MyServiceCallbackHandler

                                                              - Praful Anand

                                                              JournalDev
                                                              DigitalOcean Employee
                                                              DigitalOcean Employee badge
                                                              April 11, 2019

                                                              Execute generate.client ant target to generate the Stub classes.

                                                              - Pankaj

                                                                JournalDev
                                                                DigitalOcean Employee
                                                                DigitalOcean Employee badge
                                                                March 3, 2020

                                                                1. Security policy namespace cannot be null Exception Throwing when we send the message to the Web service listener and we are using Axis2 1.7.9 version.

                                                                - Senthil Kumar

                                                                  JournalDev
                                                                  DigitalOcean Employee
                                                                  DigitalOcean Employee badge
                                                                  April 8, 2021

                                                                  Hi Pankaj, This is a nice article. Can you please guide how to implement the service payload with attachment (external to the body with mime support ) in axis2. Thanks

                                                                  - Ranjan

                                                                    Join the Tech Talk
                                                                    Success! Thank you! Please check your email for further details.

                                                                    Please complete your information!

                                                                    Become a contributor for community

                                                                    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

                                                                    DigitalOcean Documentation

                                                                    Full documentation for every DigitalOcean product.

                                                                    Resources for startups and SMBs

                                                                    The Wave has everything you need to know about building a business, from raising funding to marketing your product.

                                                                    Get our newsletter

                                                                    Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

                                                                    New accounts only. By submitting your email you agree to our Privacy Policy

                                                                    The developer cloud

                                                                    Scale up as you grow — whether you're running one virtual machine or ten thousand.

                                                                    Get started for free

                                                                    Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

                                                                    *This promotional offer applies to new accounts only.