SOAP or REST for Web Services?
rest, soap, web-services, xml
Solution
I built one of the first SOAP servers, including code generation and WSDL generation, from the original spec as it was being developed, when I was working at Hewlett-Packard. I do NOT recommend using SOAP for anything.
The acronym "SOAP" is a lie. It is not Simple, it is not Object-oriented, it defines no Access rules. It is, arguably, a Protocol. It is Don Box's worst spec ever, and that's quite a feat, as he's the man who perpetrated "COM".
There is nothing useful in SOAP that can't be done with REST for transport, and JSON, XML, or even plain text for data representation. For transport security, you can use https. For authentication, basic auth. For sessions, there's cookies. The REST version will be simpler, clearer, run faster, and use less bandwidth.
XML-RPC clearly defines the request, response, and error protocols, and there are good libraries for most languages. However, XML is heavier than you need for many tasks.
Problem
Is REST a better approach to doing Web Services or is SOAP? Or are they different tools for different problems? Or is it a nuanced issue - that is, is one slightly better in certain arenas than another, etc? I would especially appreciate information about those concepts and their relation to the PHP-universe and also modern high-end web-applications.
Related problems
- Secure Web Services: REST over HTTPS vs SOAP + WS-Security. Which is better?
- S3 REST API and POST method
- SOAP vs REST (differences)
- Should a Netflix or Twitter-style web service use REST or SOAP?
- XML vs YAML vs JSON for data feeds in perl application?
- JSON and XML comparison
- REST web service WSDL?
- SOAP messages in REST based web service