mardi 20 septembre 2016

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




SOAP
REST
Acronyme
Simple Object Access Protocol
REpresentational State Transfer
Architecture
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
XML
In business logic
Uses services interfaces to expose the business logic.
Uses URI to expose business logic.
Standards
Defines standards to be strictly followed.
Does not define too much standards like SOAP.
Communication
Use WSDL for communication between consumer and provider.
Uses XML or JSON to send and receive data.
Transport
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.
Security
SOAP defines its own security.
RESTful web services inherits security measures from the underlying transport.
Payload
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 :
https://msdn.microsoft.com/en-us/library/ms972326.aspx
http://www.codeproject.com/Articles/1231/ASP-NET-Web-Service
https://msdn.microsoft.com/en-us/library/t745kdsh.aspx

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 : https://www.youtube.com/watch?v=e2qZvabmSvo

    RépondreSupprimer