Ajax application: using SOAP vs REST ?
- by coder
I'm building an ajax heavy application (client-side strictly html/css/js) which will be getting all the data and using server business logic via webservices.
I know REST seems to be the hot topic but I can't find any good arguments. The main argument seems to be its "light-weight".
My impression so far is that wsdl/soap based services are more expressive and allow for more a more complex transfer of data. It appears that soap would be more useful in the application I'm building where the only code consuming the services will be the js downloaded in the client browser.
REST on the other hand seems to have a smaller entry barrier and so can be more useful for services like twitter in allowing other developers to consume these services easily. Also, REST seems to Te better suited for simple data transfers.
So in summary SOAP is useful for complex data transfer and REST is useful in simple data transfer.
I'm currently under the impression that using SOAP would be best due to the complexity of the messages but perhaps there's other factors. What are your thoughts on the pros/cons of soap/rest for a heavy ajax web app?
EDIT:
While the wsdl is in xml, the data I'm transferring back and forth is actually in JSON. It just appears more natural to use wsdl/soap here due to the nature of the app. The verbs GET and POST may not be enough. I may want to say something like: processQueue, or executeTimer. This is why my conclusion has been wsdl/soap would be good for bridging a complex layer between two applications (client and server) whereas REST would be better (due to its simplicity) for allowing many developer-users to consume resources programmatically.
So you could say the choice falls along two lines
Will the app be verb-oriented (completing tasks: use soap) or noun-oriented (consuming resources: use REST)
Will the api be consumed by few developers or many developers (REST is strong for many developers)?
Since such an ajax heavy app would potentially use many verbs and would only be used by the client developer it appears soap/wsdl would be the best fit.