Slashdot Mirror


REST vs. SOAP In Amazon Web Services

tadghin writes "I was recently talking with Jeff Barr, creator of syndic8 and now Amazon's chief web services evangelist. He let drop an interesting tidbit. Amazon has both SOAP and REST interfaces to their web services, and 85% of their usage is of the REST interface." Read on for some more thoughts and information on REST and Web services, including information about a free Web services seminar on April 22nd. " Despite all of the corporate hype over the SOAP stack, this is pretty compelling evidence that developers like the simpler REST approach. (I'm sure there are applications where SOAP is better, but I've always liked technologies that have low barriers to entry and grassroots adoption, and simple XML over HTTP approach seems to have that winning combination.)

Amazon's web services have attracted a thriving community, people are making real money building alternate interfaces to Amazon and collecting Associates commissions on the resulting sales, and there are even tool developers who have come up with the creative business model of agreeing with their users to have some percentage of the transactions use the tool developer's Associates id rather than the site owner's. Cool.

Amazon is holding a free all day web services workshop on April 22 at the O'Reilly Emerging Technologies Conference. The event is open to people not registered at the conference (though space is limited to 50 people).

P.S. Slashdot really ought to have web services as a topic area! Despite being over-hyped, this is a really important area, and there's a lot cooking. Amazon's web services"

11 of 29 comments (clear)

  1. REST or SOAP: yes by jnana · · Score: 4, Insightful
    Just how do you submit a complex transactional XML document using REST? Parsing a URL query string with 200 name-value pairs, then assembling that back into the XML document that the recipient expects does not seem like a good solution. Surely, submitting a SOAP document that wraps the XML document is better in this case.

    It is understandable that Amazon sees most people using REST. They're mostly hobbyists and amateur programmers, and REST is easier and sufficient for the very simple things that you can do via the Amazon web services api, but if one were trying to submit more information -- say a long purchase order -- the limitations of REST would be more apparent. The RPC style of SOAP is often better with REST, but for the document-exchange style, REST is inadequate.

    1. Re:REST or SOAP: yes by pmz · · Score: 2, Interesting

      They're mostly hobbyists and amateur programmers, and REST is easier and sufficient for the very simple things that you can do via the Amazon web services api, but if one were trying to submit more information -- say a long purchase order -- the limitations of REST would be more apparent.

      I would bet there are significant numbers of professionals using REST, too. It has a pretty high usefulness threshold, because a lot of tasks don't require the complex hierarchical datasets allowed by XML.

      I've personally used REST instead of SOAP in an internal project, because REST is simple to implement and totally adequate for what we were trying to do. SOAP would have required: learning, sorting through buzzwords, more learning, some more sorting, and a prototype before actually creating a working system. Basically, SOAP has a higher learning curve that can (and should) be avoided when possible. Also, the tools and libraries for SOAP are much younger than those for REST.

    2. Re:REST or SOAP: yes by smallpaul · · Score: 2, Informative

      You don't undestand what REST is. There is nothing about REST that disallows the posting of an XML document. The question is how you use URLs and HTTP verbs, not what syntax you use. You say that "surely submitting a SOAP document that wraps an XML document is..." There is no question that XML is the right choice in some cases. That's why REST and XML are so often used together. But if you're going to claim that there is some benefit in "wrapping" the XML in SOAP, you'll have to back it up. In my experience, the vast majority of people "wrap" XML in SOAP but don't have any reason for doing so other than buzzword compliance.

    3. Re:REST or SOAP: yes by Kopretinka · · Score: 2, Informative
      Just how do you submit a complex transactional XML document using REST? Parsing a URL query string with 200 name-value pairs, then assembling that back into the XML document that the recipient expects does not seem like a good solution.

      The above shows just how little jnana understands REST. Note that SOAP over HTTP uses POST and does not do any URL encoding of the requests. Just why can't a simple HTTP application do the same?

      HTTP GET is to be used for retrieval only, and all URL encoding that may happen is only to identify the particular resource. In a well designed REST application no complex data structures need to go into the GET URL. For submissions to processing, there is the POST method.

      The real difference between SOAP and REST is that currently the only protocol designed around REST is an application protocol for hypermedia transfer whereas SOAP is a general protocol upon which application protocols may be built, including RESTful ones. One of the protocols already built over SOAP is the RESTless RPC.

      Disclosure: I'm a member of the W3C working group that's just now finishing SOAP 1.2.

      --
      Yesterday was the time to do it right. Are we having a REVOLUTION yet?
    4. Re:REST or SOAP: yes by j7953 · · Score: 2, Informative
      Just how do you submit a complex transactional XML document using REST?

      You can use HTTP POST with REST, so you simply POST the XML document to the appropriate URL (probably an URL that identifies some sort of handler).

      Surely, submitting a SOAP document that wraps the XML document is better in this case.

      But why do you want to wrap it?

      The thing that is "wrong" about SOAP is that everything is wrapped into a POST request, even if you aren't posting anything but simply requesting some information.

      For example, take the web service interface of some online store. I don't know Amazon's interface, but I suppose they would offer you a function to get the delivery status of your orders, and a way of sending them orders. With SOAP, if you want to send them an order, you'll have to wrap the order into a SOAP message call. With REST, you'd simply POST the order to an appropriate ressource, like http://webservice.example.com/newOrder. What an order looks like isn't defined by either SOAP or REST, so for the order itself, you'll have to build your own XML DTD (or schema or whatever) anyway. You'll also have to define a return type, obviously. In the SOAP case, that would be a SOAP message containing e.g. the order number. With REST, you could send back an application/xml response containing exactly the same data, but without the SOAP envelope.

      What about getting the status of an order? With SOAP, you would POST the appropriate method call to some ressource. With REST, you could simply send a GET request without any parameters to an appropriate URL, e.g. http://webservice.example.com/order/1234567/status . Obviously the server would need to check if the order number is valid and if the client has the permission to request the status of that order. But the HTTP protocol already defines how to handle this, there are appropriate error codes. What do you need SOAP for?

      There really isn't anything you can do with SOAP that you couldn't do with REST as well.

      Personally, I think that REST is not only simpler, but the interface also feels much more "natural", i.e. it is more consistent with how URLs and HTTP are supposed to work. I guess the main thing I dislike about SOAP is that it doesn't really utilize the full potential of the HTTP standard, HTTP is only used as a wrapper. Obviously there are situations where you want this, after all it also adds some extra flexibility. But I believe in most cases where you want a "web service" you really want a web service, i.e. you want to use HTTP anyway.

      --
      Sig (appended to the end of comments I post, 54 chars)
  2. Why Amazon provides two interfaces by darkpurpleblob · · Score: 2, Informative
    From the FAQ:
    Why does Amazon Web Services use both SOAP and XML over HTTP?

    We wanted to provide a platform that would both address the different needs of different people and provide an opportunity to further the debate between two popular Web services standards. Some developers like working with pure XML; others prefer SOAP. We didn't want to force people to use a protocol they weren't comfortable using.

  3. How Amazon Web Services came about by darkpurpleblob · · Score: 3, Interesting
    Tim O'Reilly played a integral part in getting the Amazon Web Services off the ground:

    Jeff was intrigued, and told me a day or two later that he'd discovered that his skunkworks team already had a web services API in the works. But he says that without my presentation he "might have done something stupid like shutting the project down.

    Read about the rest in Tim's weblog post.

  4. Yeah, but all the big players used soap by Kagato · · Score: 2, Interesting

    Having worked with Amazon for one of Amazons largest online stores I can say SOAP is very much here to stay. Although many may use RIST, the big online partners use SOAP. Or rather Amazons implimentation of SOAP. With does some funky stuff with MIME attachments.

    Still, once you get it worked out the process is actually pretty smooth. All my complaints are about how they use their data, not how it's transported.

  5. I just switched from REST to SOAP by Anonymous Coward · · Score: 2, Interesting

    Over the weekend, I rewrote parts of my site that use Amazon data to use SOAP, with the help of nuSoap for php. It's much cleaner code now, and it just seems to work better. I originally went with REST because it's what they first offered, and I was just too lazy to update the code until now.

  6. MIME-RPC as an alternative to SOAP and XML-RPC by cpeterso · · Score: 4, Interesting

    A quiet alternative is MIME-RPC .

    MIME-RPC is a protocol for applications written in different languages and on different platforms to communicate with each other using a public standards:
    • It works with the millions of already deployed web apps and web browsers (without plugins)
    • It handles all Internet data including Unicode, JPEG, XML, etc.
    • It works over both HTTP and SMTP (web and email)
    • It protects application programmers from wire level concerns.
    • It provides complete interlanguage object serialization (cyclic refs.) as well as interlanguage messaging
    • It supports two way communication over client/server connections
    • It is easy to implement.
    • It doesn't require an extra XML parser when your application doesn't need one.
    • Its specification is short and unambiguous.
    • It leverages existing transport layer features like encryption, proxying, asynchrony, streaming/chunking, etc.

    Notes on SOAP vs MIME-RPC:
    • SOAP does not interoperate with existing browser based apps. MIME-RPC does.
    • SOAP does not do generic object serialization
    • SOAP forces the programmer to think about type coercion because it hides foreign data as base64encoded rather than labeling it with a useful type.
    • SOAP does not handle delivery of XML or other types well. MIME-RPC does.
    • The SOAP with attachments spec basically says to use MIME. If you are doing that, you might as well use MIME for everything (and therefore MIME-RPC).
    • The SOAP with attachments spec is ambiguous about the type of attached objects. Should the type be interpreted according to its mime content-type or according to some XML schema? MIME-RPC provides an unambiguous interpretation.
    • SOAP constrains method and variable names to be consistent with XML tag names. Many languages (e.g. SQL) allow method and parameter names that are not permitted in XML tags.
    • MIME-RPC is much easier to implement correctly than SOAP
    • MIME-RPC has less processing overhead than SOAP.

  7. Use some helper code by bill_mcgonigle · · Score: 3, Informative

    I have a system that uses XML/RPC but it could have just as easily been SOAP or REST and it wouldn't make a difference. I have a data structure in Java that gets put through some helper classes, then on the server side, I have a response that feeds into a module, and I get out a data structure. So, I never actually see any XML/RPC, but I still have the advantages of the interoperability of the standard. Moral: if you're doing much with any of these protocols your code could use some more abstraction.

    --
    My God, it's Full of Source!
    OUTSIDE_IP=$(dig +short my.ip @outsideip.net)