mardi 20 septembre 2016

Difference between SOAP and REST Web Services (from generic to .NET)

Simple Object Access Protocol
REpresentational State Transfer
SOA based architecture that use middleware interoperability.
Architecture style protocol designed for web based communication assuming only point to point communication.
Message Format
XML inside a SOAP Envelope
In business logic
Uses services interfaces to expose the business logic.
Uses URI to expose business logic.
Defines standards to be strictly followed.
Does not define too much standards like SOAP.
Use WSDL for communication between consumer and provider.
Uses XML or JSON to send and receive data.
Transfer is over HTTP, Also uses other protocols such as SMTP, FTP, MIME, JMS, HHTP, etc.
Transfer is over HTTP only.
JavaScript calls
JavaScript can call SOPA but it is difficult to implement.
Easy to call from Javascript.
SOAP defines its own security.
RESTful web services inherits security measures from the underlying transport.
Payload must support SOAP schema.
Payload can be of any format.
Error Handling
Doesn't support error handling.
Has built-in error handling.
External Calls
Invokes services by calling RPC method.
Simply calls services via URL path.

What do I choose, SOAP or REST?
It depends!!

Both protocols have their advantages and disadvantages, but you should choose which protocol you are using based on the requirements of the problem. Instructing you on how to accomplish that is beyond the scope of this question and answer.
And in  .NET world, you can find more details to choose  :

And REST is more popular from ASP.NET WEB API.

And the use of SOAP is here from WebServices :

We will add a sample next post using REST ASP.NET WEB API 2.0

1 commentaire:

  1. Building Secure Web APIs with ASP.NET Core :