Since I didn’t found this on the internet (but some rather outdated or complicated tutorials) here’s how to create Java class as wrapper for a given SOAP webservice.
- Download most recent Apache Axis 2: http://ws.apache.org/axis2/download.cgi. I used version 1.5.1
- Extract it to a directory of your choice
- On the command line, change to subdirectory
wsdl2java.bat -uri [URL of WSDL file](on Windows) or
wsdl2java.sh -uri [URL of WSDL file]on Linux.
- The Java classes are created in the
src/subdirectory. Copy them into your project
To effectivly use the classes generated you must add a bunch of jars to your project dependiencies. These are found in the
lib/ directory of the extracted Apache Axis distribution. You need ([version] notes a version number):
Apache Axis generated a class class [Name of Webservice]Stub, e.g. for a webservice TimeOfDay it would be
TimeOfDayStub. This class has all the webservice’s methods and nested classes for the method’s arguments. Everything is relatively straight forward and easy to use.
There is an Apache Axis Eclipse plugin for converting WSDL into Java classes, but the download URL seems broken. I also tried to use Eclipse’s WSD toolset, but this unnecessarily requires a local web server to be set up and running.
Edit: Corrected wsdl2java parameter from