The difference between REST and WebServices

What is the difference between REST and WebService (SOAP), I looked at facebook api, they use HTTP headers and some parameters (maybe xml or non) and return the result in xml, where else SOAP does the same, HTTP headers + xml and returns the headers + xml.

REST also requires some authenticated token, where SOAP also uses an http session, which is exactly the same token that is used for authentication and other information. All I see is that SOAP is a small extended version of REST?

Or are there other performance considerations? Reading about REST simply indicates a very high level of interaction with the client server, but even SOAP does the same. Can someone tell me where he can determine the correct border between REST and SOAP.

We use a lot of SOAP transparently in .net, however I just want to know if it's really worth paying for REST, where everything is working fine now.

I know that REST is an architecture, and SOAP is a protocol, but my question is in detail, currently the ASP.NET WebService SOAP implementation has a REST architecture?

+55
soap rest web-services
Sep 18 '09 at 8:08
source share
2 answers

SOAP is a protocol for sending / receiving data over HTTP in XML format.

A typical WebService will be several WSDL methods that describe how to call it. There is no real agreement on how they should be structured, so you always need a lot of API documentation.

Usually it will be something like (for ASP.NET):

  • HTTP POST to mysite.com/products.asmx/ListAllProducts - returns an XML list of products
  • HTTP POST to mysite.com/products.asmx/GetProduct - returns XML for a SOAP-based XML product in hosted content
  • HTTP POST to mysite.com/products.asmx/UpdateProduct - Modifies a SOAP XML-based product in hosted content

REST is more of an agreement on structuring all your methods:

  • HTTP GET from mysite.com/products - returns XML or JSON listing all products
  • HTTP GET from mysite.com/products/14 - returns XML or JSON for product 14
  • HTTP POST to mysite.com/products/14 - Changes product 14 to what you publish in HTML form.
  • HTTP DELETE to mysite.com/products/14 - removes product 14
  • HTTP PUT to mysite.com/products - adds a new product

So, REST works more as you would expect the browser urls. Thus, it is more natural and how the agreement is much easier to understand. All REST APIs work the same way, so you don’t spend so much time studying the features of each system.

+67
Sep 18 '09 at 8:27
source share

For me, a service implemented using the RESTful approach benefits from one that uses SOAP or RPC in terms of its availability. In a relatively closed system, where the tools are available to create stubs and links based on WSDL, this is not so important. However, if you want to create services that are affordable and accessible to a wide range of clients, then the uniformity of REST services and the ease with which they can be used is a big plus, that is, you do not need a heavy RPC package, just the ability to make HTTP requests.

I’m not sure if this fully answers your question, but if, as you say, you have a system that works on the basis of SOAP (and you manage the client and server), then I see no reason for the change. In addition, some services will naturally be more suitable for RPC-based access, in which case the SOAP interface will be more appropriate.

In terms of performance, one or more levels will be effectively removed from the technology stacks for clients and servers if you do not use SOAP, therefore, all other things being equal, the service that provides the RESTful interface will win there.

+13
Sep 18 '09 at 8:38
source share



All Articles