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.

Hussein Terek

Founder of programmergate.com, I have a passion in software engineering and everything related to java environment.

You may also like...

Leave a Reply

avatar