SOAP – Present-Day Significance of SOAP

apirestsoapweb services

Last I encountered a SOAP based service was during my internship in a financial firm in 2013. That was the time when I started my career in IT. I remember having some study material about SOAP in one of my engineering course. Outside of that, I haven't used SOAP much during my career.

I am asking this since the question of "Difference between SOAP and REST" came in one of my recent interviews. From what I know (and what I found on Google) SOAP is a protocol with tight coupling between client and server for information interchange which is closely related to business logic. Whereas REST is more flexible stateless architecture for data transfer.

Can someone please correct me if I am wrong about this difference between SOAP and REST? Also, what is the present-day significance of SOAP? Are people still developing new SOAP-based APIs, or it's mostly a legacy now?

Best Answer

REST is indeed an architectural style. SOAP is a data protocol. The distinction is important; you cannot compare them directly.

The primary purpose of REST is to represent resources on the Internet, and to provide mechanisms for discovering them. In contrast, SOAP is used for communicating structured data between computers, and that's all it really does.

Note that you don't actually need REST to create a client/server relationship between two computers on the Internet. All you need is a mechanism that transfers JSON or XML, and you don't even need that if you're willing to be incompatible with everyone else.

Nevertheless, SOAP has fallen out of favor for new, public-facing API's, though it is still commonly used for B2B applications because you can define a "data contract" with it. JSON web services have the virtue of being rather lightweight and flexible, and since Javascript recognizes JSON natively, it's a natural choice for browsers.

But none of that has much to do with REST, really.

Further Reading
Is REST better than SOAP? (good article, even though it incorrectly calls REST a protocol).
The Richardson Maturity Model

Related Topic