The whole idea of Web Service is simplifying data access as much as possible withoutcompromising security of services. Tha...
Accessing REST services normally wont require any specialized webservice clientsbecause REST relies on HTTP methods so tha...
References :JSON vs XML code comparison : http://www.25hoursaday.com/weblog/PermaLink.aspx?guid=39842a17-781a-45c8-ade5-58...
Upcoming SlideShare
Loading in...5
×

Rest With Json Vs Soap With Xml

10,262

Published on

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
10,262
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
107
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Rest With Json Vs Soap With Xml

  1. 1. 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.
  2. 2. Accessing REST services normally wont require any specialized webservice clientsbecause REST relies on HTTP methods so that any Browser can makethe RESTified service calls.Now why should we use JSON as the defacto standard for data exchange both for makinga REST service call and communicating between services.JSON seamlessly integrates with JavaScript and Python as a simple Map Data Structurewhereas XML always required an additional syntax to define its grammer and it has ahierarchical complex data structure.User does not need to keep on creating new tags or attributes to represent new datain JSON as user can simply represent them using Key-Value pairs. In JSON, a Value canbe represented as a nested key-value structure recursively.JSON support arrays {“Orders”:["Order":"[Id:123]...."]} and is more elegant and compact. Itdoes not suffer from the - how to distinguish an attribute from a child elementproblem.JSON is fully optimized for exchanging lightweight data i.e. its not suitable for exchangingSounds / Images / Binary executable .XML is more suitable for heavy-weight payloads which is not recommended for WebService.But again handling XML requires specialized knowledge whereas JSON code can beeither converted into simple JSONObject beans that can simply be looked up for childbeans.So JSON is best for exchanging Data, where as XML is suitable for exchangingDocuments.Any Web Service Provider should adopt REST and JSON for keeping the services highlyscalable and making fast service calls and providing best user experience over web.
  3. 3. References :JSON vs XML code comparison : http://www.25hoursaday.com/weblog/PermaLink.aspx?guid=39842a17-781a-45c8-ade5-58286909226bJSON Wrapper : http://www.jspon.org/

×