Reviewing SOAP and REST
Over the course of this lesson and Lesson 15, we've looked at the REST and SOAP approaches to using web services.
Although other web services protocols exist, a significant REST versus SOAP argument has been waged among developers over the last couple of years.
I don't intend to join that argument in this book. Instead, let's summarize the similarities and differences between the two approaches:
REST leverages the standard HTTP methods of PUT, GET, POST, and DELETE to create remote procedure calls having comparable functions. Web service implementations using the REST protocol seem particularly suited toward resource-based services, where the most-used methods generally involve creating, editing, retrieving, and deleting information. On the downside, REST requires a little more knowledge about the HTTP protocol.
The SOAP protocol adds substantial complexity, with the necessity to serialize the remote call and then construct a SOAP envelope to contain it. Further work arises from the need to "unpack" the returned data from its SOAP envelope before parsing the data. These extra steps can also have an impact on performance, with SOAP often being a little slower in operation than REST for a similar task. SOAP does, however, make a more complete job of separating the remote procedure call from its method of transport, as well as add a number of extra features and facilities, such as the Fault element and type checking via namespaces.