I am currently developing an android application using webservices so at the first I couldn't make the right decesion : REST or SOAP, and what kind of data should I use .
2 回答
This depends on the type of of data and type of application you are developing.
I was solving the same issue. And as I had to synchronize databases between the server and the Android clients I've finally decided to choose REST with JSON. Each DB table was represented as 1 URL resource on the server.
Advantage of REST over SOAP for this task is that REST defines set of operations: GET, POST, PUT and DELETE (or possibly some others) that can be directly mapped to SELECT, CREATE, UPDATE and DELETE SQL commands. So there are clear rules how to exchange data.
SOAP seemed to me less convenient for the database synchronization as it is RPC style of communication rather than resource based.
As a library for REST communication I decided to use Spring Rest Client for Android: http://static.springsource.org/spring-android/docs/1.0.x/reference/html/rest-template.html
And as a JSON parsing library I've chosen GSON: http://code.google.com/p/google-gson/
Alternatively you may consider to use Jackson: http://jackson.codehaus.org/ which is possibly more advanced than GSON.
See also this video about developing Android REST client: http://www.youtube.com/watch?v=xHXn3Kg2IQE