REST vs. SOAP – The Right WebService

Web Services are the key point of Integration for different applications belonging to different Platforms, Languages, systems. It wouldn’t be wrong if you call Web-services as the “Rendezvous point of the Business”.

I’ve been using HTTP and SOAP since several years new. REST is rather new. SOAP revolutionized RPC and loose coupling  beyond the restrictions posed by  earlier protocols. However off late I have been giving APIs and interfaces considerable thought and am leaning a lot more towards simple HTTP based APIs with an XML or JSON response format as opposed to SOAP. Let’s try to discuss all the aspects one by one.

Before we start, Let’s do a basic terminology headsup –

  • SOAP refers to Simple Object Access Protocol
  • HTTP based APIs refer to APIs that are exposed as one or more HTTP URIs and typical responses are in XML / JSON. Response schemas are custom per object
  • REST on the other hand adds an element of using standrdized URIs, and also giving importance to the HTTP verb used (ie GET / POST / PUT etc)
  • Although, in alst ffew years we saw growth of large no.  of Web Services, despite that the hype surrounding the SOAP has barely reduced. Internet architects have come up with a surprisingly good argument for pushing SOAP aside: there’s a better method for building Web services in the form of Representational State Transfer (REST).

    REST is more of an old philosophy than a new technology. But a realization that came later in technology. Whereas SOAP looks to jump-start the next phase of Internet development with a host of new specifications, the REST philosophy espouses that the existing principles and protocols of the Web are enough to create robust Web services. This means that developers who understand HTTP and XML can start building Web services right away, without needing any toolkits beyond what they normally use for Internet application development.

    In a RESTful architecture, the key resources are identified — Can be entities, collections, or anything else the designer seems worthy of having its own URI. The standard methods — in this case, the HTTP verbs — are mapped to resource-specific semantics. All resources implement the  same uniform interface. The dimension of content-types, which allows for different representations of resources (e.g. in both XML, HTML, and plain text), as well as the possibility of links to resources in resource representations. Use your imagination — e.g. the GET on /customer/4711 would return a document that contains a link to a specific /order/xyz.

    I am seeing a lot of new web services are implemented using a REST style architecture these days rather than a SOAP one. Lets step back a second and put some light on what REST is.

    What is a REST Web Service

    Representational State Transfer or REST basically means that each unique URL is a representation of some object. You can get the contents of that object using an HTTP GET, to delete it, you then might use a POST, PUT, or DELETE to modify the object (in practice most of the services use a POST for this).

    How Popular is REST?

    All of the major webservices on the Internet now use REST: Twitter, Yahoo’s web services use REST, others include Flickr, del.icio.us, pubsub, bloglines, technorati, and several others. Both eBay and Amazon have web services for both REST and SOAP.

    and  SOAP?

    SOAP is mostly used for Enterprise applications to integrate wide types and no. of applications and another trend is to integrate with legacy systems, etc. On the Internet side of things — Google is consistent in implementing their web services using SOAP, with the exception of Blogger, which uses XML-RPC.

    REST vs SOAP

    The companies that use REST APIs haven’t been around for very long, and their APIs came out this year or last year mostly. So REST is definitely In-Vogue  for creating a web service.  But, lets face it — Use SOAP to wash, and you REST when your tired). The main advantages of REST web services are:

    • Lightweight – not a lot of extra xml markup
    • Human Readable Results
    • Easy to build – no toolkits required

    SOAP also has some advantages:

    • Easy to consume – sometimes
    • Rigid – type checking, adheres to a contract
    • Development tools

    Is SOAP Simple Object access really that  simple ? I guess a misnomer!

    Let’s discuss all the point of comparisons —

    API Flexibility & Simplicity
    The key to the REST methodology is to write Web services using an interface that is already well known and widely used: the URI. For example, exposing a currency converter service, in which a user enters a currency quote symbol to return a real-time target currency price, could be as simple as making a script accessible on a Web server via the following URI: http://www.ExampleCurrencyBrokerage.com/convert?=us-dollar&value=100&target=pound

    Any client or server application with HTTP support could easily call that service with an HTTP GET command. Depending on how the service provider wrote the script, the resulting HTTP response might be as simple as some standard headers and a text string containing the current price for the given ticker symbol. Or, it might be an XML document.

    This interface method has significant benefits over SOAP-based services. Any developer can figure out how to create and modify a URI to access different Web resources. SOAP, on the other hand, requires specific knowledge of a new XML specification, and most developers will need a SOAP toolkit to form requests and parse the results.

    Bandwidth Usage – REST is Lighter

    Another benefit of the RESTful interface is that requests and responses can be short. SOAP requires an XML wrapper around every request and response. Once namespaces and typing are declared, a four- or five-digit stock quote in a SOAP response could require more than 10 times as many bytes as would the same response in REST.

    SOAP proponents argue that strong typing is a necessary feature for distributed applications. In practice, though, both the requesting application and the service know the data types ahead of time; thus, transferring that information in the requests and responses is gratuitous.

    How does one know the data types—and their locations in the response—ahead of time? Like SOAP, REST still needs a corresponding document that outlines input parameters and output data. The good part is that REST is flexible enough that developers could write WSDL files for their services if such a formal declaration was necessary. Otherwise, the declaration could be as simple as a human-readable Web page that says, “Give this service an input of some stock ticker symbol, in the format q=symbol, and it will return the current price of one share of stock as a text string.”

    Security
    Probably the most interesting aspect of the REST vs. SOAP debate is the security perspective. Although the SOAP camp insists that sending remote procedure calls (RPC) through standard HTTP ports is a good way to ensure Web services support across organizational boundaries. However,  REST followers argue that the practice is a major design flaw that compromises network safety. REST calls also go over HTTP or HTTPS, but with REST the administrator (or firewall) can discern the intent of each message by analyzing the HTTP command used in the request. For example, a GET request can always be considered safe because it can’t, by definition, modify any data. It can only query data.

    A typical SOAP request, on the other hand, will use POST to communicate with a given service. And without looking into the SOAP envelope—a task that is both resource-consuming and not built into most firewalls—there’s no way to know whether that request simply wants to query data or delete entire tables from the database.

    As for authentication and authorization, SOAP places the burden in the hands of the application developer. The REST methodology instead takes into account the fact that Web servers already have support for these tasks. Through the use of industry-standard certificates and a common identity management system, such as an LDAP server, developers can make the network layer do all the heavy lifting.

    This is not only helpful to developers, but it eases the burden on administrators, who can use something as simple as ACL files to manage their Web services the same way they would any other URI.

    REST ain’t Perfect
    To be wise, REST ain’t perfect. It isn’t the best solution for every Web service. Data that needs to be secure should never be sent as parameters in URIs. And large amounts of data, like that in detailed purchase orders (POs), can quickly become cumbersome or even out of bounds within a URI.

    And when It comes to attachments, SOAP is a solid winner. SOAP can transport your all text adn BINaries without a glitch. In such cases, SOAP is indeed a solid solution. But it’s important to try REST first and resort to SOAP only when necessary. This helps keep application development simple and accessible.

    Fortunately, the REST philosophy is catching on with developers of Web services. The latest version of the SOAP specification now allows certain types services to be exposed through URIs (although the response is still a SOAP message). Similarly, users of Microsoft .NET platform can publish services so that they use GET requests. All this signifies a shift in thinking about how best to interface Web services.

    Developers need to understand that sending and receiving a SOAP message isn’t always the best way for applications to communicate. Sometimes a simple REST interface and a plain text response does the trick—and saves time and resources in the process.

    Type Handling
    SOAP provides relatively stronger typing since it has a fixed set of supported data types. It therefore guarantees that a return value will be available directly in the corresponding native type in a particular platform. Incase of HTTP based APIs the return value needs to be de-serialized from XML, and then type-casted. This may not represent much effort, especially for dynamic languages. Infact, even incase of copmlex objects, traversing an object is very similar to traversing an XML tree, so there is no definitive advantage in terms of ease of client-side coding.

    Client-side Complexity (Thinner Clients)
    Making calls to an HTTP API is significantly easier than making calls to a SOAP API. The latter requires a client library, a stub and a learning curve. The former is native to all programming languages and simply involves constructing an HTTP request with appropriate parameters appended to it. Even psychologically the former seems like much less effort.

    Testing and Troubleshooting
    It is also easy to test and troubleshoot an HTTP API since one can construct a call with nothing more than a browser and check the response inside the browser window itself. No troubleshooting tools are required to generate a request / response cycle. In this lies the primary power of HTTP based APIs

    Server-side Complexity
    Most Programming languages make it extremely easy to expose a method using SOAP. The serialization and deserialization is handled by the SOAP Server library. To expose an object’s methods as an HTTP API can be relatively more challenging since it may require serialization of output to XML. Making the API Rest-y involves additional work to map URI paths to specific handlers and to import the meaning of the HTTP request in the scheme of things. Offcourse many frameworks exist to make this task easier. Nevertheless, as of today, it is still easier to expose a set of methods using SOAP than it is to expose them using regular HTTP.

    Caching
    Since HTTP based / 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

    VERDICT

    In the end I believe SOAP isn’t that simple, it requires greater implementation effort and understanding on the client side while HTTP based or REST based APIs require greater implementation effort on the server side. API adoption can increase considerably if a HTTP based interface is provided. Infact,  an HTTP-based API with XML/JSON responses represents the best of both breeds and is easy to implement on the server as well as easy to consume from a client.

    For consuming web services, its sometimes a toss up between which is easier. For instance Google’s AdWords web service is really hard to consume (in CF anyways), it uses SOAP headers, and a number of other things that make it kind of difficult. On the converse, Amazon’s REST web service can sometimes be tricky to parse because it can be highly nested, and the result schema can vary quite a bit based on what you search for.

    Which ever architecture you choose make sure its easy for developers to access it, and well documented. In the end when you host Web-service for the internet, it’s the client side complexity that matters most in attracting them to use your service. Choose wisely.

    VN:F [1.9.22_1171]
    Rating: 9.2/10 (167 votes cast)
    VN:F [1.9.22_1171]
    Rating: +77 (from 93 votes)
    REST vs. SOAP - The Right WebService, 9.2 out of 10 based on 167 ratings

    Related Posts

    Bookmark and Promote!

    • bqlr

      why not compare them in scalability, REST is better than SOAP

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Chopper

      Hi, overall I like the comparison. However, I don’t think that you’ve spent enough (or any) time on the benefits of WDSL. For people working with enterprise web services, the reason that SOAP persists is that WSDL makes it possible to define a service contract in an external document that is readable by 3rd party applications. Until WSDL 2.0 is formalised, that isn’t the case for REST. If you use a tool with a graphical front end (such as Sonic ESB, Aqualogic, Fiorano, etc.), you will see that the big win is that an interface is dynamically created from the WSDL allowing drag and drop mapping data into request parameters and out of the response. This is where SOAP wins hands down at the moment – speed of development using graphical tools.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Pingback: What You Should Know About VoIP Phones | Intro to SIP Systems

    • azeroth

      Isn't your example http://www.ExampleCurrencyBrokerage.com/convert… unRESTful? Isn't REST more about webish CRUD?

      Also, who provides the processing of returned data to extract whatever you need? When you use SOAP or XML-RPC, the library does it from you but with REST you're supposed to parse the returned XML manually, right?

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Pingback: What is Windows Azure

    • Chris

      SOAP has not stood for Simple Object Access Protocol for quite some time now.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Pingback: Java EE 6 Features Overview

    • Mike

      Your article makes a mistake in the statement that says, 'For example, a GET request can always be considered safe because it can’t, by definition, modify any data. It can only query data.'

      GETs can indeed modify data, they are just supposed to not modify data. The end resource of whatever the GET points to (the code that ultimately runs) can edit, delete, remove or whatever.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Pingback: Text to Speech API

    • Mike

      Your article makes a mistake in the statement that says, 'For example, a GET request can always be considered safe because it can’t, by definition, modify any data. It can only query data.'

      GETs can indeed modify data, they are just supposed to not modify data. The end resource of whatever the GET points to (the code that ultimately runs) can edit, delete, remove or whatever.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
      • nnan

        And the world is not just a few HTTP action words. I developed many SOAP projects. It takes a couple of minutes to configure or copy and paste old ant code, then I go off doing my things, don't have to worry about the transport layer. Even better, I works with API just like my code. Not all those states the REST crowd are trying to promote. I think one main problem with SOAP is that it can be extremely easy to develop with some Ant script and Apache axis. However, people don't know how that, and gets into problem. Also, stick with doc/lit, and mostly you'll be fine. The one most important point the author miss is that the transport layer should be as transparent as possible. With SOAP, I can go on quickly without worry about it at all. Basically, I don't develop SOAP most of the time, because why on earth I need to do that? I just develop my business logic. SOAP was done in a couple of minutes, and no longer needed until I need to update (which is extremely quick and simple too).

        VA:F [1.9.22_1171]
        Rating: 0.0/5 (0 votes cast)
        VA:F [1.9.22_1171]
        Rating: 0 (from 0 votes)
    • Michael Jiang

      I have hand on experiences with both REST and SOAP.
      I would prefer SOAP in that with today’s SOAP Tool kit, almost all major programming languages can compile WSDL to generate SOAP client library can be a big deal in terms of automation integration.
      All the pros and cons that author motioned are correct. REST response is simple and user readable. But wait… Why human want to read the response? There is HTML for human already! The web services mean to system to system (B2B) communication. SOAP is designed for high level automation. Of course it hard for human to read SOAP message (actually not that hard), it is for machine to read!
      For SAOP client: Just download WSDL or load WSDL from its url, the tool kits (include JAVA, .NET(C#,VB), PHP, C++, etc) will automatically discovered methods and generates the library for you. You can call the methods presented by the WS server right in the client code no matter what the language you use. You call WS methods without write any code. Furthermore in server side even the WSDL can be auto generated in JAVA, C#, etc. The server side only need implements the methods, and with tools, the client can automatically call those methods. It is that simple for SOAP WS. Plus there are a lot more in SOA, ESB.
      For REST: WS methods cannot be auto discovered. The WS provider has to provide client library and has to be well documented on every method. It is a huge effort to create the lib (for all major languages) and synch with its documentation. If WS providers do not have the lib, you have to wait for a community to develop them or you have to develop the lib yourself by the doc. Again the methods are not auto discovered, and easily out of the synch. When you get a “500 Internal Server Error”, you may aware that the APIs changed, but what is the change?
      In short, SOAP, high level auto, easy to plug in, easy consuming, SOA enabled. higher overhead. REST, fast. Not easy for sys-sys communicate, but easy for human consuming(why?), not SOA enabled.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • rhoerbe

      “Google is consistent in implementing their web services using SOAP” – not true. Most APIs build on Google' Data PI, that is kind of RESTful. The Google SOAP search API was deprecated in 2006.

      Binary data is still a problem with SOAP; SwA is no official, MTOM requires binary to base64 converison and back; REST has the capability of using MIME-attachments, but tool support needs to be established.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: -1 (from 1 vote)
    • adr

      http://www.petefreitag.com/item/431.cfm

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Kailash

      Very nice article, thank you!

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Plagiarism

      This article plagiarizes this website:

      http://www.petefreitag.com/item/431.cfm

      Shameful

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Ionut

      One small typo (I think).. In the following paragraph:

      “Representational State Transfer or REST basically means that each unique URL is a representation of some object. You can get the contents of that object using an HTTP GET, to delete it, you then might use a POST, PUT, or DELETE to modify the object (in practice most of the services use a POST for this).”

      “to delete it” should be “to view it”

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: +1 (from 1 vote)
      • Elvis

        <nitpicking>
        Actually, I don't think it should be “to view it”, if you pay attention to the punctuation.

        “You can get the contents of that object using an HTTP GET,” => The comma indicates end of subsentence
        “to delete it, you then might use a POST, PUT, or DELETE to modify the object.” => This is a new subsentence.

        However, I do agree that the comma, in addition to “to delete it” before the request types and “to modify the object” causes some confusion.

        Personally, I would replace the comma, and leave “to delete it” out all together, like this:
        “You can get the contents of that object using an HTTP GET. You then might use a POST, PUT, or DELETE to modify the object (…)”
        </nitpicking>

        Also, it would've been decent to mention part of it came from http://www.petefreitag.com/item/431.cfm .

        Otherwise, nice article!

        VA:F [1.9.22_1171]
        Rating: 0.0/5 (0 votes cast)
        VA:F [1.9.22_1171]
        Rating: 0 (from 0 votes)
    • Dave

      I think you're ignoring one of the major benefits of the SOAP model, namely the contract you get when with the WSDL. It's important for clients to understand exactly what your services support. Relying on human produced documentation is risky at best, whereas an auto generated WSDL will always give you an accurate description of the services. And when the services interface changes, your clients will know because they will start getting errors. None of that happens with REST. If you make an contract breaking change, you have to notify (or try to notify) everyone who uses the service and then they have to pour over the documentation to try to figure out how to recode the client. With a WSDL it's obvious how the client works. An code generation tool can give you a nice object tree with all the types and methods cleanly described. Now THAT'S simple.

      Yeah REST is the technology dujour, but a lot of the arguments I see for it fail to give SOAP the props it deserves.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: +1 (from 1 vote)
      • Kingwulf

        You are missing the client generation part of it. Without it WSDL is hardly useful.

        VA:F [1.9.22_1171]
        Rating: 0.0/5 (0 votes cast)
        VA:F [1.9.22_1171]
        Rating: 0 (from 0 votes)
    • Yohoboyo

      You are not the author of this post. It is a blatent plagiarism of other websites.

      http://www.devx.com/DevX/Article/8155

      http://www.petefreitag.com/item/431.cfm

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • morph

      I would use restful web service if i have to expose a resource in an efficient way for example if i am hosting a image hosting, file hosting because caching can easily be enabled on rest based service, But when it comes to exposing my complex business methods SOAP based web services are still far better because it has a standards document WSDL which helps in specifying the contract that an end user can understand easily and hence the client code can be written with ease against it.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Lamu_36

      Sorry for the inconvenience, I know where I can find an example of using RESTful web services and SOAP, but the example is the same

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Raftian

      Great article indeed, atleast now I have a fairly good idea of which way to go when I want to expose my underlying data to external apps made by other guys. Don’t know if you have this article on another website, if not, then someone just ripped it off and put it up as theirs. The url where you can get this same article is http://greatgandhi.wordpress.com/2010/06/16/soap-vs-rest-%E2%80%93-the-best-webservice/

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • kartik sirigeri

      I am new to webservices and trying to understand which one best suits my needs. Found your article very helpful. what do you think about Hessian?

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • kartik sirigeri

      I am new to webservices and trying to understand which one best suits my needs. Found your article very helpful. what do you think about Hessian?

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Nuwan_dammika

      Very good article., Thank you

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • http://www.facebook.com/SpJavaWebsite Sp Java

      Its very good to know the difference between REST and SOAP. PLease share some more articles on this topics

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • http://www.carinsurancewa.net/tacoma-car-insurance Car Insurance Tacoma

      When you are in the process of comparing rates for auto insurance, you
      need to be sure that the deals you are getting are the best that they
      can be. It is all about getting the most out of your car insurance
      policy, and since the world of insurance is a highly competitive one,
      you are sure to be able to find some excellent deals out there!

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
      • hk

        fuck u

        VA:F [1.9.22_1171]
        Rating: 0.0/5 (0 votes cast)
        VA:F [1.9.22_1171]
        Rating: +1 (from 1 vote)
    • Ssf

      Excellent article.  I better understand the two approaches than I ever have before trying to read up on it.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Asd

      Really nice comparision

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • http://profile.yahoo.com/H4FHLBHP5YHONCHQMW3RDGC22E Y

      Beautiful article!! Thanks a lot!!!

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • rj

      good focus…

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Shibin

      nice explanation…. thank you boss !!

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Chankrit

      Great article.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • bips

      nice elaboration and clearly highlighted key points of each of the webservice options

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Giri

      an excellent one! thanks

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • http://www.facebook.com/sean.lanoue Sean Lanoue

      SOAP does have a lot of flaws, but you gloss over some issues with REST.

      1) REST testing is very easy when it comes to GET calls. Just go to a browser, enter the URI, and check results. PUT, POST,DELETE are not as simple to send a request from a browser. You may have to write your own client or get another 3rd party tool for your QA department to test.

      2) Also, updating records using REST could throw business errors. Yes you can return HTTP header errors, but not all browser or clients can access the HTTP Header.

      3) Using LDAP is great for security if there is not a large number of consumers of your REST. If you have over a million users.. LDAP security will not cut it.

      SOAP biggest flaw I think is the fact that it does not return different data types EG: JSON, Image, PDF

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
      • Patrick Duc

        1) Plain wrong. Just use a Chrome or Firefox extension for REST, and you’ll be able to test a POST, PUT or DELETE as easily as a GET request.
        2) Plain wrong. A REST client speaks HTTP (just as a browser, by the way), and therefore consulting the HTTP return code is trivial.
        3) Are you talking about LDAP or REST/SOAP ? As far as scalability is concerned, REST is way better than SOAP, since the servers are stateless, there is no heavy SOAP enveloppe, and the Web infrastructure can take advantage of the uniform interface REST services use (for caching data).
        4) I’m afraid you see only a little part what REST gives you, compared to SOAP : simplicity, scalability; performance, independance between clients and servers… It’s on the architectural side that lie the biggest advantages of REST, not on the detail (though right) of the format you can get in return.

        VA:F [1.9.22_1171]
        Rating: 0.0/5 (0 votes cast)
        VA:F [1.9.22_1171]
        Rating: 0 (from 0 votes)
      • Hylianux

        “updating records using REST could throw business errors.”

        Then handle them on the server-side? What does this have to do with REST? If there are any business errors when trying to insert them, then be sure to let the user know about them in your response back to the user… Whether you do this with SOAP or REST is irrelevant…

        VA:F [1.9.22_1171]
        Rating: 0.0/5 (0 votes cast)
        VA:F [1.9.22_1171]
        Rating: 0 (from 0 votes)
    • Flout

      This is a bit too much oriented in favour of REST APIs which does not help too much to choose agnostically :( But yet it gives some good inputs !
      Don’t forget about the context in which you need to decide whether you should use one or the other.
      If you need to do Server to Server communication, working with a different supplier, you better ensure your service contracts are well and strongly defined. Also, almost all data oriented flows would rather take benefit of using a structured envelop instead of having arguments passed in a URI.
      Considering the difficulty of implementing on client or server side is not really an issue for SOAP web services as it is based on standards and most tools can generate the skeleton for you from the WSDL. Even better, ESB-like tools will enable you to drag-drop a component, configure it and tadaaaaa…. your web service is ready to be exposed !!!
      Considering statelessness, that is also to be considered depending on the physical architecture (cluster of servers with load balancing) of your solution and the type of operations that needs performing. In which case REST might not be the best choice.
      Receiving plain text in web services responses !!! OMG !!!
      That’s ok only if you need to display the result in a web page. But if you need to write a client that will have some intelligence based on the result… I wish you good luck ;)
      I’m probably missing some other points there but these are only a few comments :-p
      From my point of view, SOAP web services covers a larger set of requirements than REST web services.
      However, for client web-ui that needs to consult data, I would consider using REST over SOAP.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
      • Hylianux

        “Receiving plain text in web services responses !!! OMG !!! … if you need to write a client that will have some intelligence based on the result… I wish you good luck ;)”

        This assumes your response is a single word or value, not a structure of values like, say, a json string, which can be easily parsed into whatever language-specific data type/model you’ve made on the client end (be that a browser or otherwise).

        “If you need to do Server to Server communication, working with a different supplier, you better ensure your service contracts are well and strongly defined.”

        You can define WADL’s and WSDL’s in REST if you need your services to be strongly-defined.

        “Also, almost all data oriented flows would rather take benefit of using a structured envelop instead of having arguments passed in a URI.”

        In either case, you’ll need to code validations on both ends that determine whether or not the data was valid. The envelope just adds an extra step. Whether there’s an envelope or not, the client still has to be certain that the data they’re submitting fits what the service is expecting.

        VA:F [1.9.22_1171]
        Rating: 0.0/5 (0 votes cast)
        VA:F [1.9.22_1171]
        Rating: 0 (from 0 votes)
    • Patrick Duc

      … and Google followed this track on : the RPC-based GWT is not their favorite GUI tool anymore (if it has ever been…).
      AngularJS seems to be the new choice, a better one I believe.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    • Hylianux

      Quite a few things here make me scratch my head…

      One of your pros for REST is:

      Easy to build – no toolkits required

      And one of your pros for SOAP is:

      Development tools

      Is this not a giant contradiction? Is having to use a toolkit a pro or not? I personally think the fact that I need external tools in order to use SOAP or develop SOAP applications is a HUGE con.

      Also: “Data that needs to be secure should never be sent as parameters in URIs. And large amounts of data, like that in detailed purchase orders (POs), can quickly become cumbersome or even out of bounds within a URI.”

      You can send a POST request and not worry about the length at all. What you’re really saying here is “Data the needs to be secure should never be sent as parameters in a GET”. In both SOAP and REST, you would send secure data via a POST. And if you’re worried about security, send them over https.

      “And when It comes to attachments, SOAP is a solid winner. SOAP can transport your all text adn BINaries without a glitch. In such cases, SOAP is indeed a solid solution.”

      REST is perfectly capable of this as well… How is SOAP better-suited for this exactly?

      “Most Programming languages make it extremely easy to expose a method using SOAP. … Making the API Rest-y involves additional work to map URI paths to specific handlers and to import the meaning of the HTTP request in the scheme of things. Offcourse many frameworks exist to make this task easier. Nevertheless, as of today, it is still easier to expose a set of methods using SOAP than it is to expose them using regular HTTP.”

      Fair point, because with SOAP everything is in one place. However, this can also be a bad thing. If your SOAP service has, say, 25 methods exposed, you’re now forcing the client to implement all 25 of them on their end. What if the client is only going to use 2 of those methods? Now I’ve got 23 methods in my code I’ll never use, but still have to maintain. If those methods ever change, I have to change them on my end… Changing methods I don’t use so it’ll continue to work with your service…

      Yes, it’s a little extra work to add a different URI for each function, but that little bit of work up front can save a lot of work in the long run. And since development time and ease is of a concern here, frameworks exist to really simplify this process… In java (specifically Spring), I need little more than a URL mapping annotation, and a line defining what I want the request object to be, and the response object. Everything else is handled exactly the same.

      VA:F [1.9.22_1171]
      Rating: 0.0/5 (0 votes cast)
      VA:F [1.9.22_1171]
      Rating: 0 (from 0 votes)
    © 2014 Geeknizer. All rights reserved. XHTML / CSS Valid.
    Designed by taranfx.