Axis2 – Generate a SOAP client from WSDL

This tutorial provides a step by step guide on how to generate a SOAP client from WSDL using Apache Axis2.

The steps are pretty straightforward, if you follow them in order you will end up generating java classes that you can use for consuming the desired service.

1. Download Axis2

Firstly, download the binary distribution of the Axis2 library from here.

Download Axis2 library

2. Copy WSDL to Axis2 folder

The next step is to copy the WSDL of the service under the bin folder of the Axis library.

If you only have a service URL, you can simply open the URL in the browser then append “?wsdl” and then click right click -> save as and save it to your file system. (With this way, you need to make sure that all dependent XSDs and WSDLs are downloaded too and their path are updated in the main WSDL accordingly).

3. Generate client classes

Before generating the client classes and running the Axis2 command, you have to make sure that you already set the JAVA_HOME environment to point to your Java location.

Now in order to generate the client classes, follow the below steps:

  • Go to the bin folder of the Axis2 library.
  • Press on shift and right-click at the same time and open the CMD inside the bin folder.
  • Finally, run this command:

.\wsdl2java.bat -uri <PATH_OF_WSDL> -p org.apache.axis2.axis2userguide -d adb -s -u

The client classes are now generated under a folder named “src” under the bin folder.

5 1 vote
Article Rating

Hussein Terek

Owner of, I have a passion for software engineering and everything related to Java environment.

1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
9 months ago

I have created the Stub file from wsdl with Axis2 jar but when i try to use the stub in my websphere, it is not working. And no errors in logs to debug the issue.

I just added required axis2 jars in my application and deployed it in webshere.

Can someone confirm if any configuration need to be done webshere to use axis2 jar.