Monday, February 15, 2010

REST vs. SOAP

Among all the rest that are there - here's a good link which exemplifies the differences between the two philosophies and lists out the Pros n Cons.

The fundamental difference between REST Web services and document-style Web services is how the service consumer knows what to expect out of the service. Web services have contracts, defined in WSDL. Since Web services focus on the service, rather than on the resource, the consumer has clear visibility into the behavior of the various operations of the service, whereas in REST's resource-oriented perspective, we have visibility into the resources, but the behavior is implicit, since there is no contract that governs the behavior of each URI-identified resource

Points to take home:

1) SOAP is a protocol for distributed XML based computing. REST is for simple point to point communication using plain old XML.

2) SOAP Envelope( optional header + mandatory body) is often bulkier for following reasons:
  • a) Attributes: Since is designed to be used in a distributed environment with multiple nodes processing a SOAP envelope, its gonna contain role and relay attributes.
  • b) Encoding [Rules on how a data value should be encoded in an XML format]
  • c) Extensions and Versions
3) REST on the other hand is simple & concise -and it makes use of GET PUT POST DELETE methods of HTTP protocols to support CRUD communication over the network. REST using Flex Find it all here. But the bottom line is another name for Flex HTTPService class is REST style web service. For REST-style services, you use a server resource such as a PHP page, JavaServer Page (JSP) or servlet, or ColdFusion page that receives a POST or GET (or a PUT or a DELETE) request from a Flex application using the HTTPService component. That server resource then accesses a database using whatever means are traditional to the particular server technology.

The results of data access can be formatted as XML instead of HTML, as might be typical with the server technology, and returned as the response to the Flex application. Flex, Adobe® Flash® Player, and Adobe AIR™ have excellent XML- handling capabilities that let you manipulate the data for display in the Flex application user interface. REST-style services provide an easy way to access a server resource without a more formalized API such as those provided by web services or remote object services. These services can be implemented using any number of server technologies that can get an HTTP request and return XML as the response

No comments:

Post a Comment