What is REST?
- REST stand for Representational State Transfer.
- REST is an architecture style for designing networked applications.
- REST relies on a stateless, client-server, cacheable communications protocol.
- REST uses HTTP for all four CRUD (CREATE/READ/UPDATE/DELETE) operations.
- REST is a lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and Web Services (SOAP, WSDL, et al.).
Why REST is lightweight compare to SOAP?
IF we do any request in REST service, let’s suppose we want to know the stock detail using REST, then REST will return only data structure defined by XSD (Data Contract) but the SOAP will wrap the structure into SOAP envelope. The complexity of SOAP envelope is based on used message version and additional WS* protocols.
You can at least expect something like this from SOAP response:
- <s: Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
- <s: Header/>
- <S: Body>
- <result>
- <stock name="XYZ">
- <value>100</value>
- <exchange>ABC</exchange>
- </stock>
- </result>
- </s:Body>
- </s:Envelope>