Easy understanding of SOAP API and REST API

In IT field API is the magical term. I too wonder what is that. So I'm gonna help you to understand this magical word very easily. Before I move to the main topic , I clearly explain what is the meaning of API.

API

GDS launches government API catalogue | UKAuthority
API stands for Application Programming Interface. We can clearly understand through this acronyms API is a interface. 
In real world, let we assume that you are in a restaurant. So what we do first? Yes, we used to call a person who serve the food. Then we request him our favourite food item. waiter is carrying that request to kitchen and come back to our table with that requested food. 
So, through this example you can understand that waiter is the interface between the customer and cook. Waiter is carrying our request then respond back to us.
Like wise, API is the interface between the client and server.
Now we move to main topic one by one.

SOAP API and REST API

Is REST better than SOAP? Yes, in some use-cases

01) SOAP API

SOAP stands for Simple Object Access Protocol. This is the XML based protocol. The main advantage of SOAP API is it's own security.It's a messaging protocol for interchanging data in a decentralized and distributed environment.
It's using HTTP, SMTP, TCP or UDP protocols. SOAP API used to return the response as XML format. This XML is consist following parts such as:
  • Envelop : This is the starting and ending tag of the message.
  • Header : It contain external attribute of the message.
  • Body : It contains the data for the recipient. 
  • Fault : It contains the error messages during the processing time.
So, now we are going to look where we used SOAP API?As I said SOAP API having it's own security. Therefore, we used this API for enterprises level which need high security and complex transaction.
Eg: Financial services ,Payment Gateways, Identity management and telecommunication.

02) REST API

REST stands for Representational State Transfer. It's a style of software architecture. This API is high demand in now. This API accept different data format like JSON , Plain text,HTML ,XML. It's inherits security measure from the transport protocol.

for more detail you can check my previous blog https://arebhyunix.blogspot.com/2018/04/rest-api.html 

So now we quickly check what are the main different between these APIs.

SOAP API vs REST API

SOAP REST
Meaning Simple Object Access Protocol Representational State Transfer

Design
Standardized protocol with pre-defined rules to follow.Architectural style with loose guidelines and recommendations.
ApproachFunction-driven (data available as services, e.g.: “getUser”)Data-driven (data available as resources, e.g. “user”).
StatefulnessStateless by default, but it’s possible to make a SOAP API stateful.Stateless (no server-side sessions).
CachingAPI calls cannot be cached.API calls can be cached.
SecurityWS-Security with SSL support. Built-in ACID compliance.Supports HTTPS and SSL.
PerformanceRequires more bandwidth and computing power.Requires fewer resources.
Message formatOnly XML.Plain text, HTML, XML, JSON, YAML, and others.
Transfer protocol(s)HTTP, SMTP, UDP, and others.Only HTTP
Recommended forEnterprise apps, high-security apps, distributed environment, financial services, payment gateways, telecommunication services.Public APIs for web services, mobile services, social networks.
AdvantagesHigh security, standardized, extensibility.Scalability, better performance, browser-friendliness, flexibility.
DisadvantagesPoorer performance, more complexity, less flexibility.Less security, not suitable for distributed environments.

Comments

Popular posts from this blog

Easy understanding of MVC design architecture

A / B Testing

Firewall