0

What would be best and simplest way to call Yahoo weather webservice/any json webservice in android? Some people suggest not to use Ksoap for mobile application instead use Restful or Json webservice.

TIA Bhaskar

snail
  • 151
  • 3
  • 9

3 Answers3

0

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/

djg
  • 1,283
  • 9
  • 6
  • Thanks it worked so far. Now I am looking for list of available webservices which are restful and jason enabled. Like flight tracker and weather service etc. – snail May 09 '11 at 19:16
0

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.

Community
  • 1
  • 1
Geoff
  • 773
  • 1
  • 6
  • 13
  • My journey started from the same link you sent, but did not have much idea of restfull webservice initially so dropped that but djg's link, given below, just worked fine. – snail May 09 '11 at 19:18
0

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

Mike
  • 1,000
  • 1
  • 10
  • 18