What are web services?
So let's discussed about the web service you can think in a situation you have two systems you want to communicate between them , system A and system B but both system are hosted in different environment, so you cannot directly access them , whenever we want to communicate between two different services for two different applications we need the concept of Web Services.
So that's how the web service actually came into the picture.
The other advantages are both applications can be technology independent, in one service might be written in Java and another service might be written in C sharp or any other language.
Let's take an example of a payment gateway: suppose you want to order an item you want to buy a product from an app like Flipkart, so what will you do , search for the product, add it into the cart and finally you will do the payment.
Flipkart has third party payment gateways Apis, so you cannot directly access their system, you have to use some securities and authentication process and then only you can use their services.
We have two type of web services, SOAP and REST Based. SOAP is actually the older way of creating Web Services, where we have only one format of data that is XML, but in rest API we can transfer the data in several formats like XML, JSON or text or anything any other format you want.
That's why in a microservice architecture we use a rest API because it's fast and lightweight and we can make it secure.
No comments: