开发者

mysql to android using soap

i know very well that android not support the mysql but i need to connect mysql and get the infor开发者_开发技巧mation from database

i studied there are SOAP and REST services to connect mysql from android is it possible?then give me one idea and if possible one example pls


i need to connect mysql and get the information from database

You can get the data from the database with or without connecting to it. You can get it with or without SOAP. An agent on the server, usually a CGI sript makes the database request on the client's behalf. In SOAP, the the query and response are often encoded in XML, and always transmitted by standard Internet methods such as HTTP or SMTP.

Non SOAP methods include CORBA, simple RPC, and home-grown solutions. If the database is open to the Internet, then a direct connection to the database port on the server is possible.

It's only the security restrictions that limit what you can do. In an environment where only mail, HTTP and FTP are possible, SOAP is a good protocol. If the client is actually a web browser, then AJAX is ideal.

For a typical data request, all you need to know is the URL (and associated protocol) on the server to query for the data. For example, using HTTP:

http://dataserer.example.com/chart_data.cgi?chart_num=2 

The server-side script, chart_data.cgi reads the query (from a GET request in this case), retrieves the information from the database and sends it, encoded in XML, back to the client, simply by writing the HTTTP header and XML content to standard output. It is Javascript and a browser protocol XMLHttpRequest that make the HTML request and XML receipt possible.

So even in Android, when you browse the web and see all that information, on Amazon for example. A lot of that information is retrieved by agents at Amazon from their database, formatted for the client(the browser on Android) and sent back to the client. No Android-specific coding is required.

Use a custom remote agent such as a CGI script on a server to access a remote database. Android only needs to communicate with the agent.


Write a SOAP server using the language of your choice:

  • Google: Soap Server

Call it from Android:

  • How to call web service with Android

Of course, you don't have to do it in SOAP. You can just output the data from your web service in any format like JSON, plain text, XML, CSV, (or even HTML?) ... and consume it from Android.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜