Friday 19 January 2018

REST Vs SOAP



SOAP is a protocol whereas REST is architecture.

SOAP exposes behavior which represent logic whereas REST exposes resources which represent data.
 
In terms of consumption REST service is much simpler than SOAP. With REST overhead of handling XML envelops is eliminated which makes it more fast as
compare to SOAP.

 
SOAP provided good security options as compared to REST.
 
For machine to machine interaction & enterprise solutions SOAP is preferable but for public facing API’s REST is best option almost 70% public API’s are REST.
 
REST is lightweight, maintainable & scalable.
 
REST is device independent i.e. client consuming REST API can be anything like Mobile devices, Notebooks, TV etc.
 
With the cloud coming in action. Application is slowly moving to cloud based systems such as Azure, Amazon AWS. These systems are build and exposing REST API’s. Hence it is a good moveto build application on the top of the REST API.

Restful Web Service - Quick Introduction




Introduction

REST (Representational State Transfer) architecture uses HTTP protocol for data communication.
REST is introduced by Roy Fielding in 2000.

RESTful web services are resources on the web and you are allowed to perform certain actions (HTTP Methods) over it.

Resource in REST is identified by URI’s and representation of state is in the form of XML, JSON
etc.
 

Resource in REST can be anything like Text file, HTML Page, Images, Video or dynamic business
data.


Key elements
1. Resource
2. Request Verbs (GET, POST, PUT & DELETE)
3. Request Header & Body
4. Response Header & Body
5. Response Status Code


Characteristics
1. Client Server architecture
2. Stateless (In case of maintaining the client interaction extra information needs to be
send) [Independent Question Answer]
3. Cache


Commonly used HTTP Methods
1. GET
2. POST
3. PUT
4. DELETE
5. OPTIONS


Address format 
<protocol>://<service_name>/<resource_type>/<resource_id>
 
1. Use plural nouns e.g. customers
2. Instead of “ ” use “_” or “-” for big names
3. Use lower case letters
4. Maintain the backward compatibility i.e. when new version is releases use the response
code 300 for redirect

Spring Boot JPA

Spring Boot JPA  In 5 Simple Steps Integrate PostgreSQL Database | Tuorial - 4 Hello Friends, Welcome to Spring Boot JPA tutorial...