1

I want to access an online MySQL database in order to retrieve and manipulate data. I read that the best way would be implementing an own web-service, which returns XML and then parse it in Android, is it right?
Does anybody have a basic tutorial?

4

2 に答える 2

3

Since you want to access a remote server which has your DB and other stuff. You basically have two options.

1 - ) Either directly access your server via sockets etc.

2 - ) Or create a web service which will connect your server to the outside. ( I.e : Android Client,iOs client etc.)

The best practice is to create a web service and then consume it in your Android application.

Check these for consuming XML in Android.

http://www.ibm.com/developerworks/opensource/library/x-android/

http://www.warriorpoint.com/blog/2009/07/19/android-reading-using-and-working-with-xml-data-and-web-services-in-android/

Check these for creating web services on server side. (Stack independent)

http://davidwalsh.name/web-service-php-mysql-xml-json (PHP)

http://www.roseindia.net/webservices/buildingsimplewebservice.shtml (Java)

http://www.codeguru.com/csharp/csharp/cs_webservices/article.php/c19391/Creating-a-NET-Web-Service.htm (.NET)

And so on there are a lot of stacks to create web services.

于 2012-05-24T14:09:34.497 に答える
0

Again, Webservice is the best approach. But you have to take decision based on the amount of the data being retrieved from the server and how often the transaction needs to be synchnorized with the server.

What Arvind was trying to explain you, incase if the volume of data is too large to download via webservice then you probably need to think of some middle tier that will convert he data to json and send it to your device. The reason, if you are transmitting the 1k of soap response over the air, for the same response, if you are transmitting thro json, it could be 100k or 200k or 300k depends. That way you can save the transmission cost over the net and turnaround time is quicker .

于 2012-12-18T23:05:48.767 に答える