Can I use both REST and SOAP in an Android application?
I am trying to build an Android application.
It has a SOAP-based Web service from which it needs to consume the data.
I have a middle-ware Worklight server implementation too.
The data coming from the Web Service is huge and is actually all the data is not needed all the time. I was planning that I would use the middleware Worklight server to consume the SOAP web service, rather than the Android app itself, parse the data and then expose the required bits as a RESTful service and the data format JSON rather than SOAP XML format.
I think that this will take the load of parsing the huge XML data off the app. Is this a good approach?
I see no problem with your overall design, ie consuming the large chunk of data from the SOAP call in your middleware server and then only exposing the specific things you need for your Android clients.
It will at least save you bandwidth on your Android devices (which is a really good thing) and most likely a few lines of code in your Android project since your REST data will be tailored for your specific use-cases.
JSON or XML? What better fits your needs.
I'd advice you to look at versioning your REST services though. This is a good start: Best practices for API versioning?
链接地址: http://www.djcxy.com/p/71514.html