Sunday, June 27, 2010

SOAP vs REST

更多精彩请到 http://www.139ya.com

http://www.webforefront.com/archives/2005/05/rest_-_represen.html
SOAP vs. REST [ XML/HTTP ] :The Web Services debate.

There is no doubt that web services will continue to be a common practice when developing web applications, the capability of accessing business functions in a platform & device agnostic manner has made the technology a champion among J2EE, .NET, PHP and other web platforms. But even though the concept is clearcut, there seems to be two emerging camps defining how to implement a web service: SOAP and XML/HTTP (a.k.a REST-Representational State Transfer ).
[Entry continues to the left and below ad ]

Before you jump the gun on the lesser "advertised" XML/HTTP REST approach as not being a web service, the fact remains that it complies with a web service definition : The capability of accessing information in a platform transparent manner. And if you consider the thorough REST support offered by early web services adopters like Amazon and EBay, you can conclude that REST is not a fad.

The most obvious difference between both approaches is the actual payload that is transferred through the wire, which directly translates into distinct implementation details on both client & server. Lets explore the differences.

A REST design implies that a web application is equipped for returning a plain and simple XML fragment as a response to a URL request. Lets assume you make a call into the following address: http://www.yoursite.com/restapp/weather.php?city=sandiego. A REST type application would return a payload like the following snippet back to the caller:


http://www.webforefront.com/about/danielrubio/articles/techtarget/rest_design.html

REST: Simplicity in Web Services design

Linking Web service requesters and providers entails a fair amount of work for both parties, encompassing such things as agreeing on the business function to be fulfilled, the technical contract details and of course integrating the service into the grander scheme of an application. But far too often using the standardized SOAP/WSDL approach becomes overly complex in such scenarios.

There is an alternate approach to deploying a Web services compliant architecture named REST, Representational State Transfer. REST is a technique coined by Roy Fielding in the year 2000 during what was his doctoral dissertation, While it is questionable if he had the prescience to create an approach that would compete head-to-head with industry heavyweights and consortium specifications, since then the REST acronym has come to center stage in Web services design.

What is it about REST that makes it different from standard SOAP/WSDL? The simplicity in shedding some of the heavyweight requirements needed in the latter approach, which on many occasions prove unnecessary to achieving the basic functionality of a Web service.

No comments: