If you are an Android Developer you probably know how hard it may be to develop webservices based applications. The lack of official support for these implementations is compensated by some modules like ksoap2 that handle de SOAP stuff and communication.
For simple cases where you just have to send/receive simple data types it is easy to use, but things can get a bit complicated when you need to handle complete data types with dozens of different functions.
That’s why someone created the automatic stub generator. A stub is a set of classes generated automatically from the WSDL so you don’t have to create all functions, definitions and data types available in the WSDL by hand.
You can download the ksoap2 jar from here.
You can download the stub generator from here or you can try my online version of the stub generator filling the input box with the WSDL URL and press download.
I really enjoy the blog post.Really thank you! Awesome.
David, this is great! With your online stub generator, I could finally auto-create the classes I needed (complex types in messages). I tried to do it offline with the latest stub generator jar, but it gave my a NullPointerException – for the same WSDL that your online tool handled perfectly.
Apparently I’m not the only one with this issue, see http://stackoverflow.com/questions/5937218/web-services-stub-generation-android
What version of the stub generator are you using?
I had the same problem over and over again until I tried a different source for the jar. I can’t remember where did I get it but it does work 🙂
You can download it here: http://www.davidgouveia.net/ksoap/ksoap2-generating-stub-0.1-SNAPSHOT-jar-with-dependencies.jar
Just call it like the older version: java -cp ksoap2-generating-stub-0.1-SNAPSHOT-jar-with-dependencies.jar:$JAVA_HOME/lib/tools.jar ksoap2.generator.Wsdl2J2me -w [WSDL_URL] -g [OUTPUT_PATH]
Have fun 😉
Funnily enough, it does the same. But meanwhile I discovered that despite the Exception, it still _does_ generate all the files. The Exception must come after all the important stuff has been done. Thanks for this great find!
The generating stub generates code with references to java.rmi which is not included within android by default..
i need to access a webservice with nested complex types.
i tried on basic types and succeeded.
Not sure if I can help because all I did was a simple wrapper for the .jar available on the Internet. Have you tried the wsclient from neurospeech?