Rest With Json Vs Soap With XmlDocument Transcript
The whole idea of Web Service is simplifying data access as much as possible withoutcompromising security of services. Thats where REST outplays SOAP. The systemshould be designed as Resources and should be identified by URLs. Then the servicesshould be accessed by a small set of remote methods describing the actions to beperformed on the resource. This is how REST smoothly fits into such architecture as anatural choice when services are stateless and interpreted as Resource URL.For example, the best way make a POST request using REST :http://127.0.0.1:8080/myrestservices/loanservice/acceptLoan with the JSON / XML as thebody of the request.RESTful styles perfectly suits for AJAX Tools where multiple web service calls might beperformed very frequently. SOAP suffers from huge overhead of Headers and heavy XMLpayloads even for a simple service call.REST should be the used specially where Bandwidth is limited such as PDA and MobileDevices.Particularly REST can be easily implemented into existing system of URL oriented staticresources without much refactoring or change in existing system architecture.Since SOAP needs to carry lots of additional information like Quality ofService, WS Transaction, Security etc. its suitable for integrating complex heterogeneoussystems and specific cases where a service call tends to needs to perform multipleoperations in a blocking mode and needs to communicate signals back and forth betweenservice provider and consumer before performing a WS-Transaction.Otherwise, its always better to simple use REST binding for web service and intercept theservice call to ensure security and QOS and then perform the actual transaction withoutoverloading the headers.Proxy Servers can be setup to cache stateless services effectively.
References :JSON vs XML code comparison : http://www.25hoursaday.com/weblog/PermaLink.aspx?guid=39842a17-781a-45c8-ade5-58286909226bJSON Wrapper : http://www.jspon.org/