introduction to rest
TRANSCRIPT
REST Introduction
KUMAR [email protected]
Agenda REST Concept REST Constrains REST Data Elements REST V.S. SOAP REST V.S. SOA How to be RESTful Q&A
REST ConceptREST is
Representational State Transfer between Resourcebetween Resource
A style of software architecture
A Virtual state-machineA network of web pages (a virtual state-machine), where the user progresses through an application by selecting links (state transitions), resulting in the next page (representing the next state of the application) being transferred to the user and rendered for their use.
• Client-Server• Separation principle• Components Independent
• Stateless• Session state on the client• Visibility, reliability and scalability• Trade off (network performance, etc.)
• Cacheable• A response can be cacheable• Efficiency but reduce reliability
• Layered system• System scalability
• Code on demand (optional)• Extension after deployment
• Uniform Interface• Simple
REST Constraints
• Resources and Resource Identifiers• Uniform Interface (GET, PUT, POST, DELETE)• Resource Oriented• Simple and simple is beautiful
REST Data Elements
HTTP Method CRUD Desc.POST CREATE Create -GET RETRIEVE Retrieve Safe,Idempotent,Cacheable
PUT UPDATE Update Idempotent
DELETE DELETE Delete Idempotent
Representations• HTML / XML / images / sounds / …
REST Data Elements
SOAP • Simple Object Access Protocol
• RPC protocol that go through firewalls
• Communication protocol between applications
• A format for sending messages
REST V.S. SOAP
REST•“The Web is the universe of globally accessible information”• Resource oriented• User-driven interactions via forms• Few operations (generic interface) on many resources• URI: Consistent naming mechanism for resources• Focus on scalability and performance of large scale distributed hypermedia systems
SOAP•“The Web is the universal transport for messages”• Activity/Service oriented• Orchestrated reliable event flows• Many operations (service interface) on few resources• Lack of standard naming mechanism• Focus on design of integrated (distributed) applications
REST V.S. SOAP
Two of most common styles of use of Web Services•Service-oriented architecture
• “Message oriented” (SOAP)• Contract provided by WSDL
•REST• Focus on interacting with stateful resources, rather than messages or operations.
REST V.S. SOA
REST V.S. SOA
Correlation • REST is an architectural style that inherently helps to attain some of the basic SOA principles.
SOA principles •Standardized Service Contracts•Service Loose Coupling•Service Abstraction•Service Reusability•Service Autonomy•Service Statelessness•Service Discoverability•Service Composability
REST principles •Unique identifiability of the resources through URIs•Uniform interface to access the resources•Navigability of the resource representations through hypermedia •Statelessness
Thank you!
REST Introduction