Friday, August 21, 2020

What are the differences between REST and SOAP?

 

  1. SOAP stands for Simple Object Access Protocol whereas REST stands for Representational State Transfer.
  2. The SOAP is an XML based protocol whereas REST is not a protocol but it is an architectural pattern i.e. resource-based architecture.                         
  3. SOAP has specifications for both stateless and state-full implementation whereas REST is completely stateless.
  4. SOAP enforces message format as XML whereas REST does not enforce message format as XML or JSON.
  5. The SOAP message consists of an envelope which includes SOAP headers and body to store the actual information we want to send whereas REST uses the HTTP build-in headers (with a variety of media-types) to store the information and uses the HTTP GET, POST, PUT and DELETE  methods to perform CRUD operations.
  6. SOAP uses interfaces and named operations to expose the service whereas to expose resources (service) REST uses URI and methods like (GET, PUT, POST, DELETE).

  7. SOAP Performance is slow as compared to REST.

.net core and .net framework difference

Developers use the. NET framework to create Windows desktop applications and server-based applications. This includes ASP.NET web applications. NET Core is used to create server applications that run on Windows, Linux, and Mac.

SingleorDefault vs Firstordefault example

Single

It returns a single specific element from a collection of elements if the element match found. An exception is thrown, if none or more than one match found for that element in the collection.


SingleOrDefault

It returns a single specific element from a collection of elements if the element match found. An exception is thrown if more than one match found for that element in the collection. The default value is returned, if no match is found for that element in the collection.


First

It returns the first specific element from a collection of elements if one or more than one match found for that element. An exception is thrown, if no match is found for that element in the collection.


FirstOrDefault

It returns the first specific element from a collection of elements if one or more than one match found for that element. The default value is returned, if no match is found for that element in the collection.