Image of Axis2 – Generate a SOAP client from WSDL

ADVERTISEMENT

Table of Contents

Introduction

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

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.

Summary

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

Next Steps

If you're interested in learning more about the basics of Java, coding, and software development, check out our Coding Essentials Guidebook for Developers, where we cover the essential languages, concepts, and tools that you'll need to become a professional developer.

Thanks and happy coding! We hope you enjoyed this article. If you have any questions or comments, feel free to reach out to jacob@initialcommit.io.

Final Notes