This article is to compare REST vs SOAP. There is huge difference between REST and SOAP. Comparing SOAP and REST is not just right as they are different things. It is like comparing orangutan and octopus, I have high regard for both of them. But still, as it is a popular topic lets have a discussion on SOAP vs REST.

Roy Fielding was a member of the team that wrote the specification for HTTP and co-founder of Apache HTTP server project. He introduced the word REST and the concept in his doctoral thesis in 2000. REST disruptively took over as an architectural style for web services implementation.

  • SOAP stands for Simple Object Access Protocol. REST stands for REpresentational State Transfer.
  • SOAP is a XML based messaging protocol and REST is not a protocol but an architectural style.
  • SOAP has a standard specification but there is none for REST.
  • Whole of the web works based on REST style architecture. Consider a shared resource repository and consumers access the resources.
  • Even SOAP based web services can be implemented in RESTful style. REST is a concept that does not tie with any protocols.
  • SOAP is distributed computing style and REST is web style (web is also a distributed computing model).
  • REST messages should be self-contained and should help consumer in controlling the interaction between provider and consumer(example, links in message to decide the next course of action). But SOAP doesn’t has any such requirements.
Ads by Google
  • REST does not enforces message format as XML or JSON or etc. But SOAP is XML based message protocol.
  • REST follows stateless model. SOAP has specifications for stateful implementation as well.
  • SOAP is strongly typed, has strict specification for every part of implementation. But REST gives the concept and less restrictive about the implementation.
  • Therefore REST based implementation is simple compared to SOAP and consumer understanding.
  • SOAP uses interfaces and named operations to expose business logic. REST uses (generally) URI and methods like (GET, PUT, POST, DELETE) to expose resources.
  • SOAP has a set of standard specifications. WS-Security is the specification for security in the implementation. It is a detailed standard providing rules for security in application implementation. Like this we have separate specifications for messaging, transactions, etc. Unlike SOAP, REST does not has dedicated concepts for each of these. REST predominantly relies on HTTPS.
  • Above all both SOAP and REST depends on design and implementation of the application.

This Web Service tutorial was added on 13/11/2012.

previous post: Send Email in Java using GMail SMTP with JavaMail

next post: Fail Fast vs Fail Safe

58 comments on “REST vs SOAP

  1. This of course, begs the question: “Which is the octopus, which is the orangutan, and why?”

    • :-) its my attempt at humour and long way to go. So happy to see you comment Matt. Thank you.

      I remember instances when you tried hard to impart RESTful philosophy to us and many discussions on uniform URL, atomicity and status codes.

    • i think , octopus and orangutan used as a term and reference to make readers clear how to compare this two things SOAP vs REST, recently i write a REST service using jersey framework and face difficulty to design URL for different service , expecting more on REST from Joe. Thanks a lot for such a good site.

  2. good summary. can you please give a simple example where each one is preferred or appropriate?

    • My personal preference is to always go with RESTful services unless otherwise there is a specific mandate that requires SOAP based services.

      In restricted security scenarios where we need something more than transport security then we can think about SOAP.

      • then the question aries how you will compensate WS-security, session, WS_transactions etc with REST?

      • REST only works over HTTP and HTTPS. WS/SOAP works over HTTP, HTTPS, SMTP, XMPP, etc etc.
        So you can send SOAP requests through email, securely, if you want.
        SOAP support transactions too.

        So there are more difference than stated in this article.

        Yes, most SAOP frameworks can produce RESTful interfaces too. So you get both world there.

  3. Although it is always said that REST dominant over SOAP but as i think REST is only suitable to small or mid size application as far as the enterprise level development specially in vertical industry like banking etc is concerned SOAP is preferably used due to its security and governance implementation …am i right joe sir?

    • The web based banking transactions we do rely only on the HTTPS. End user authenticates over HTTPS, once authenticated every action done by that user is legitimate. Web based banking transactions work based on this principles.

      If the above is fine, then RESTful services can be used for banking transactions too. SOAP has well defined, detailed WS-Security specification.

      In REST we just use HTTPS to secure our messages over network. In SOAP using WS-Security spec, we can use message encryption, signature and all these over HTTPS. If we feel transport security alone is not sufficient, we can go with SOAP and WS-Security. It is all left to the requirement and chance we can take.

  4. SOAP has the advantage over RESTful services in message level security.

  5. Rest-ful APIs can be consumed using simple GET requests, intermediate proxy servers / reverse-proxies can cache their response very easily. On the other hand, SOAP requests use POST and require a complex XML request to be created which makes response-caching difficult

    • If you only uses GET, you are not using REST. In REST, you use POST when you update the state (database) on the server.
      Never use GET to update state, as it is supposed to be omnipotent.

  6. Hi Joe,

    This is nice info about SOAP and REST. It would be nice if you have code based examples as well.


  7. Nice attempt to compare REST and SOAP. Yes, it is like comparing Oranges with Apples. I am sharing this through my

  8. Dear Joe,
    It was very good attempt. but, it seems like summary. As yogesh said, it would be more powerful if there is code based examples. I am waiting for that.

  9. Hi Joe,

    A tip for you : You have a habit of saying ” does not has” like for example “But SOAP doesn’t has any such requirements”

    The correct grammar is “it does not have”. Lot of desis do that mistake.

    “But SOAP doesn’t have any such requirements”

    • It should be… lot of desis make that mistake.

  10. which is the best one to implement in online shopping website development

  11. The intelligent, resourceful and complex octopus is SOAP. And, the colorful, inventive, free spirited orangutan is REST.

      • Actually, I think most people would agree that the orangutan is the more intelligent of the two. However, the octopus is probably the smartest invertebrate creature living today.

  12. Hi Joe,

    Am new to this webservices. The above differences you mentioned sounds good. I have one basic query, what is the difference between Rest vs Restful. In some places you have mentioned Rest and Restful in some other places. Both are same ? or different. If its different, can you tell me where both stands and what is the difference ?


    • REST is the acronym for the concept (just the name). When we say RESTful, it is adhering to REST’s philosophy.

      RESTful services means, services that follows the REST philosophy(rules/concepts).

  13. hi Joe please call me
    if you are staying in Bangalore.

  14. Hi Joe,

    As you said,Even SOAP based web services can be implemented in RESTful style.Does the SOAP services supports http methods other than post.

  15. REST works on HTTP channel, while SOAP works on HTTP, FTP, SMTP channels.

    Rest requires no client side library written in WSDL like SOAP.

    • thats correct. we require third party libraries for soap. ex. in android, we require KSOAP2 Library. but for REST, we dont require anything like this.

  16. Not sure if it was intentional or not, but I think the key missing thing is do explain in brief what is SOAP and what is REST. That is what I was looking for. So I will go to wikipedia. The information was very useful. Thanks.

  17. sir,
    i would like to know more about REST can u please provide more information on it i had google out but still unclear with concept also is REST and ROA are same n what is SOAP vs SOA

  18. I want to take a seminar In REST topic in my college, So can u plz give some like.

  19. Hi Joe,

    This is nice info about SOAP and REST with nice content. It would be nice if you have code based examples as well.

    Expecting more examples soon Joe.

    Thanks, Sridhar Goranti

  20. Thanks for your efforts and the useful information.

    still want to know more of the concepts about both ,I am a beginner and I would like to understand them both and then to read the comparison again.

  21. am working on bigdata, so which one is more usefull?

    and whether the soap without wsdl act as rest?

  22. Your website content is very simple and straight forward. Please be aware of few grammatical mistakes. I don’t think “doesn’t has” is correct it should be like “doesn’t have”

  23. Really nice post … But which one is good at scalability?

  24. Very nice summary, very very useful. Thanks Joe.

  25. Hi Joe,

    i am planning to create a mobile application.having a few clarifications whether i could use SOAP for this?? could you help me out your suggestions for this ?? and also let me know what could be suitable either REST/SOAP if it comes for mobile apps.

  26. Hi Joe , I am a big fan of your website , I have been following your website for past 3-4 years. I like your blogs because of the simplicity and ease of understanding. I have one question for you , Using a RestFul Webservice , How can we invoke or call SOAP Based webService ?

    • on the corp of your restful WS you have to write a SOAP Client , So by invoking the REST WS , the responsible method will invoke the SOAP client too and their you SOAP WS will be invoked by the rest WS , The SOA architecture is something like this

  27. Pingback: Post to Twitter using Java

  28. Your initial description compare “apples to apples” this is over exaggerated.
    Both are same…you did not describe much about what is different in terms of the purposes, covered only the implementation and technical’s.

    But good try by consolidating all technical/implementation differences.

  29. Joe, The article is good. Can you please suggest a common framework to use REST as well SOAP based webservice. I can think of Apache CXF. But i need your suggestion. Thanks.

  30. Hi, Can you please tell me few similarities between SOAP and REST. Thanks

  31. Is SOAP outdated?. Why should we use REST instead of SOAP?… What do you think is the best?. Which is most widely used? What percentage of companies are really using SOAP? IS one alternative to another?.If i learn both ,wont I get confused?. Is it mandatory to learn both ? Isn’t it enough to learn either SOAP or REST?..

    • No! SOAP and REST should be used as the situation demands. It depends on the use cases you are applying. Its better you learn both.

  32. CAn any one please explaing what does it means by ‘REST follows stateless model’?
    Also are SOAP and WSDL one and the same?

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>