Let’s look at SOAP vs REST.

First, the technology stacks of SOAP and REST are quite different.

SOAP REST
Communication Protocol Quite complex. Simple,  reuse HTTP verbs
XML Yes  No
HTTP Yes Yes

Second, let’s look at what problems SOAP and REST try to solve. I will use Microsoft’s implementation as examples. Microsoft’s implementation of SOAP is ASP.NET web service, and REST is Web API.

ASP.NET web service (SOAP) was designed to solve complex business problems around 2000. The architecture was similar to remote procedure call (RPC) style, and based on complex protocol. The protocol can be described using XML. Visual studio makes programming ASP.NET web service a breeze and hide most of the complexity. Visual Studio creates a local proxy to program against, and make the RPC seamless and effortless. In addition, WSDL, a web service description language, was created behind the scene to make all these possible. However, it is very cumbersome to create the HTTP posts manually without Visual Studio because we have to know the protocol instead, which is not an easy task.

Around 2006, WCF was created. WCF is a superset of ASP.NET web service. So use WCF unless you maintain legacy applications.

With the coming of mobile devices and single page applications, etc., the business requirements shift. We don’t just solve complex business problems, and we need to solve simple business requests as well and more efficient. More developers from other technology stacks other than Microsoft find communication through short and simple message exchange more appealing. WCF including ASP.NET web service cannot solve the new business requirements naturally and efficiently. The overhead came with WCF and ASP.NET web service was too much.

JSON emerges as the default communication protocol on top of HTTP. Web API takes advantage of HTTP Verbs and the popular MVC style, and provide a solid foundation for REST. The business requirements are exposed as resources, and HTTP verbs are the actions again these resources. We can think about the resources as objects, and these objects offer implicit methods such as GET, POST, DELETE, PUT, etc. So we can say the programming paradigm changes. Although less descriptive, REST and JSON is easy  to learn, flexible, and have a light footprint.

 

 

Advertisements