You can use NetBeans to parse the WSDL, it will create all the classes you need, and you can always call the operations (edit) using the code i wrote in my next post.
While KSOAP can call operations only when you know the parameters and return, the NetBeans generated code reads the WSDL and tells you what parameters you need and how the response looks like, which makes it as easy as calling a normal method.
There is one downside tho, you can only send and recieve Java types (int, double, String, etc.). Using XML complex types is only possible with KSOAP because JAXB is not yet implemented for J2ME.
Hope this helps !
If you have any questions please ask,
The first thing you need to do is to have a WSDL address, like http://localhost:8080/DEMOWS/services/DEMO?wsdl. Then you create a J2ME project in NetBeans. Then you right click on your project and select "New J2ME Web Service Client...", you enter the WSDL address and you are finished. The WSDL will be imported automatically by NB and all the code will be generated.
Once you've done this, you can use any WS operation at any time in your code. I was wrong in my first post, right click -> insert code can only be done in J2SE, in J2ME you use this code:
Once you write "service." NetBeans will show you all the operations with their parameters and what they return, just like a normal method.
Thanks a ton Alex. I did the same thing. But what i want to do is...i want to reduce my j2me application size by not including wsdl and stubs and other return type specific classes. So what i want to know is "Does KSOAP come to the rescue in here? Will it not create stubs and wsdl on mobile device? "
In brief when can i use KSOAP? I hope i am not irritating you by answering too many questions.
Don't worry about asking too many questions, i know how it is when no one helps you So just ask freely, if i can, i will help.
So, kSOAP does not create any classes, kSOAP calls the WS address you give it, you write the parameters manually. So basicly kSOAP is the manual way to call a WS operation.
The ksoap2 library contains the following classes:
which are used to call a WS operation.
Then you must read the SOAP response again manually.
Say you want to call an operation that looks like this:
public boolean login(String username, String password)
Here is the complete code how to call a WS operation using kSOAP:
Maybe seeing the code gives you an ideea how kSOAP works, you can just put this code in your J2ME application and use it, nothing else is needed. No stubs / classes will be generated.
Unfortunately these are the only 2 ways i know how to call a WS operation, and i find using kSOAP more efficient, althought it's slightly more complex.
Feel free to ask if you have any more questions or don't understand something,