How do i consume a webservice in android?

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

How do i consume a webservice in android?

Postby Bugail » Fri Oct 17, 2008 3:37 pm

Hi everyone,

Just completed my first android application (basically a hello world with a dialog). Now i'm looking to move on to something more interesting. I'm trying to get some data from a webservice and display the results in a list.

My webservice would be like http://localhost/webservices/SearchService.asmx, my method name is SearchStaff and the parameter is called searchText.

Can anyone tell me where would i begin.
Bugail
Freshman
Freshman
 
Posts: 2
Joined: Fri Oct 17, 2008 3:26 pm

Top

Postby frigo » Thu Oct 30, 2008 1:58 pm

android doesn't support http://localhost/ requests (it's an emulation) ... so if you want to connect with your webservice you'll need another host (the ip of your computer will do it for the beginning).

write an xml-parser for the soap-document and handle all the different cases OR just download the ksoap2 package for android (http://www.tuxpan.com/android-soap/andr ... -build.zip - powered by http://groups.google.com/group/android- ... 9309d7b10f). but be aware - there have been some bigger changes for http-connections in last android versions, so you may have to write your own http-connection class for the ksoap2 package.

then just invoke your webservice and use it ;)
frigo
Freshman
Freshman
 
Posts: 5
Joined: Mon Jun 02, 2008 12:33 pm

Postby Bugail » Tue Nov 04, 2008 4:52 pm

Thanks for the link, exactly what i was lookiing for. Now i just need to make it work!!
Bugail
Freshman
Freshman
 
Posts: 2
Joined: Fri Oct 17, 2008 3:26 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 5 guests