Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How REST is "lightweight"?

I have been seeing SOAP is "Heavy Weight" and REST is "Light Weight". On what parameters, we are telling REST is lightweight than SOAP?

We were using IFW model web services in our company earlier. But our management told us to develop all the new APIs going forward in REST. We are backend service providers in my company.

How REST is best useful for us?

What does "lightweight" means in context?

This question seems like repetition but don't understand the terms used.

like image 581
Manoj Avatar asked Nov 20 '13 06:11

Manoj


1 Answers

REST gives you a session less window into a system. It does not track you, it does not care about you. All you have done is send a request which contains..hopefully some id to verify that you can make it. It may return a HTTP status code, it may return some body but ultimately, once the request is complete you are forgotten.

SOAP is heavy in a sense that it describes a "contract" between the remote system and your client. In order for your client to communicate effectively it MUST implement its schema...this is the SOAP skeleton. It describes the calls you can make and the objects you can expect back.

The reason why SOAP is heavy is because of serialization. Upon each SOAP request you typically serialize a java object, send it over HTTP and get a serialized response which is deserialized into an object via reflection...this is heavy. It also means that if the endpoint changes how they work, you must change your contract. You don't have to do this with REST.

With SOAP you run into multi threaded issues.

To answer quickly..

they might mean that a REST service is "lightweight" because you do not need to release changes to clients. You simply make changes to your logic, retaining URLS and the response should remain the same.

With SOAP...if you added a new field to an object, you would have to get the client to implement the new schema. SOAP is pretty old had.

like image 180
Slihp Avatar answered Sep 21 '22 12:09

Slihp