Calling webservice from android application without Ksoap
What would be best and simplest way to call Yahoo weather webservice/any json webservice in android? Some people s开发者_StackOverflow社区uggest not to use Ksoap for mobile application instead use Restful or Json webservice.
TIA Bhaskar
In short, use HttpClient
, HttpGet
, and JSONObject
Without any more details, this is probably similar to what you are attempting: http://www.josecgomez.com/2010/04/30/android-accessing-restfull-web-services-using-json/
Here's another post where this is discussed:
How to call a SOAP web service on Android
If you really want to be simple, just embed the content of the message in a HttpClient (included with Android by default) and manually parse the result.
Here (http://breaking-catch22.com/?p=127) is a link to an example of calling a REST web service.
Have a look at how Google APIs Client Library for Java does it, for example in this YouTube sample using HttpTransport and JSON:
http://code.google.com/p/google-api-java-client/source/browse?repo=samples#hg%2Fyoutube-jsonc-sample%2Fsrc%2Fcom%2Fgoogle%2Fapi%2Fclient%2Fsample%2Fyoutube
精彩评论