REST Introduction 吴海生 博克软件(杭州)有限公司.

Slides:



Advertisements
Similar presentations
웹 서비스 개요.
Advertisements

Give it a REST already Arnon Rotem-Gal-Oz VP R&D xsights
System Wide Information Management (SWIM)
Representational State Transfer (REST) Paul Townend 8 th February 2007.
REST - Representational State Transfer
REST & SOAP Peter Drayton
REST Vs. SOAP.
Building and using REST information services Rion Dooley.
Introduction to Web Services
REST (Representational State Transfer)
Web Services Copyright © Liferay, Inc. All Rights Reserved. No material may be reproduced electronically or in print without written permission.
Web Service Ahmed Gamal Ahmed Nile University Bioinformatics Group
General introduction to Web services and an implementation example
Building RESTful Interfaces
Snejina Lazarova Senior QA Engineer, Team Lead CRMTeam Dimo Mitev Senior QA Engineer, Team Lead SystemIntegrationTeam Telerik QA Academy SOAP-based Web.
Thoughts on Architecture for the Internet of Things Group Name: Working Group 2 - Architecture Source: Nicolas Damour, Sierra Wireless
Chapter 3: Programming Web Services Service-Oriented Computing: Semantics, Processes, Agents – Munindar P. Singh and Michael N. Huhns, Wiley, 2005.
REST Introduction. REST Concept REST is between Resource R epresentational S tate T ransfer between Resource A style of software architecture A Virtual.
Why RESTafarians live shorter Lyntale Javazone 8. september 2010 André Wiik Seniorkonsulent Webstep AS.
1 Introduction to XML. XML eXtensible implies that users define tag content Markup implies it is a coded document Language implies it is a metalanguage.
B. RAMAMURTHY Web services. Topics What is a web service? From OO to WS WS and the cloud WS code.
CS 415 N-Tier Application Development By Umair Ashraf July 6,2013 National University of Computer and Emerging Sciences Lecture # 9 Introduction to Web.
Web Services Michael Smith Alex Feldman. What is a Web Service? A Web service is a message-oriented software system designed to support inter-operable.
Not Dead Yet! Cloud Breathes New Life into SOA Jason Bloomberg Copyright © 2012, ZapThink, a Dovèl Technologies Company.
WEB SERVICES AN EVALUATION OF MODERN WEB SERVICE ARCHITECTURES Gordon Hew COMS E6125 Web Information Management Systems.
Web Architecture & Services (2) Representational State Transfer (REST)
REST.  REST is an acronym standing for Representational State Transfer  A software architecture style for building scalable web services  Typically,
Microsoft Visual Studio 2010 Muhammad Zubair MS (FAST-NU) Experience: 5+ Years Contact:- Cell#:
What is Service Oriented Architecture ? CS409 Application Services Even Semester 2007.
Web Services XML-RPC, SOAP, REST Advanced Web-based Systems | Misbhauddin.
Microsoft Visual Studio 2010 Muhammad Zubair MS (FAST-NU) Experience: 5+ Years Contact:- Cell#:
Web Services (SOAP, WSDL, UDDI) SNU OOPSLA Lab. October 2005.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 09. Review Introduction to architectural styles Distributed architectures – Client Server Architecture – Multi-tier.
1 Advanced Software Architecture Muhammad Bilal Bashir PhD Scholar (Computer Science) Mohammad Ali Jinnah University.
REST - Introduction Based on material from InfoQ.com (Stefan Tilkov) And slides from MindTouch.com (Steve Bjorg) 1.
1 Seminar on Service Oriented Architecture Principles of REST.
World Wide Web “WWW”, "Web" or "W3". World Wide Web “WWW”, "Web" or "W3"
Web Architecture update for WSAWG/WSDL TAG published Principles of the Web Contents: –Identifiers Most of the work –Formats Not much –Protocols Summary.
SOAP-based Web Services Telerik Software Academy Software Quality Assurance.
Advanced Web Technologies Lecture #4 By: Faraz Ahmed.
Representational State Transfer (REST). What is REST? Network Architectural style Overview: –Resources are defined and addressed –Transmits domain-specific.
Service Oriented Architecture + SOAP -Robin John.
RESTful Web Services What is RESTful?
REST By: Vishwanath Vineet.
Web Technologies Lecture 10 Web services. From W3C – A software system designed to support interoperable machine-to-machine interaction over a network.
Representational State Transfer COMP6017 Topics on Web Services Dr Nicholas Gibbins –
Software Architecture Patterns (3) Service Oriented & Web Oriented Architecture source: microsoft.
REST REPRESENTATIONAL STATE TRANSFER Scott Ainsworth & Louis Nguyen (Group 1) Old Dominion University, CS 791: Web Syndication Formats, January 29, 2008.
REST API Design. Application API API = Application Programming Interface APIs expose functionality of an application or service that exists independently.
Intro to REST Joe Gregorio Google. REST is an Architectural Style.
Service Oriented Architecture (SOA) Prof. Wenwen Li School of Geographical Sciences and Urban Planning 5644 Coor Hall
Introduction to Web Services
Thoughts on Architecture for the Internet of Things
Sabri Kızanlık Ural Emekçi
WEB SERVICES.
REST- Representational State Transfer Enn Õunapuu
Unit – 5 JAVA Web Services
Representational State Transfer
Ashish Pandit IT Architect, Middleware & Integration Services
Enterprise Application Integration Styles
Service Oriented Architecture + SOAP
$, $$, $$$ API testing Edition
Service-Oriented Computing: Semantics, Processes, Agents
Web services introduction, application and its future
Distributed Systems through Web Services
REST på Microsoft-stacken
Introduction to SOA and Web Services
Introduction to Web Services and SOA
Service-Oriented Computing: Semantics, Processes, Agents
Presentation transcript:

REST Introduction 吴海生 博克软件(杭州)有限公司

Agenda REST Concept REST Constrains REST Data Elements REST V.S. SOAP How to be RESTful Q&A

Representational State Transfer between Resource REST Concept REST is Representational State Transfer between Resource A style of software architecture A Virtual state-machine A 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.  The software architecture of a program or computing system is the structure or structures of the system, which comprise software components, the externally visible properties of those components, and the relationships between them. Examples: Client-server model Event-driven architecture Service-oriented architecture Three-tier model For distributed hypermedia systems such as the World Wide Web. Is not limited to the HTTP protocol. RESTful architectures can be based on other Application Layer protocols if they already provide a rich and uniform vocabulary for applications based on the transfer of meaningful representational state. A style is a named set of constraints on architectural elements that induces the set of properties desired of the architecture.

REST Constraints 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 Client-Server Improve the portability of the user interface across multiple platforms Improve scalability by simplifying the server components. supporting the Internet-scale Stateless (to server) Request from client to server must contain all of the information necessary to understand the request, Session state is therefore kept entirely on the client. Induces the properties of visibility, reliability, and scalability. Visibility is improved because a monitoring system does not have to look beyond a single request datum in order to determine the full nature of the request. Reliability is improved because it eases the task of recovering from partial failures. Scalability is improved because not having to store state between requests allows the server component to quickly free resources, and further simplifies implementation because the server doesn't have to manage resource usage across requests. Cacheable A response to a request be implicitly or explicitly labeled as cacheable or non-cacheable. The advantage of adding cache constraints is that they have the potential to partially or completely eliminate some interactions, improving efficiency, scalability, and user-perceived performance by reducing the average latency of a series of interactions. The trade-off, however, is that a cache can decrease reliability if stale data within the cache differs significantly from the data that would have been obtained had the request been sent directly to the server. Code on Demand REST allows client functionality to be extended by downloading and executing code in the form of applets or scripts. This simplifies clients by reducing the number of features required to be pre-implemented. Allowing features to be downloaded after deployment improves system extensibility. However, it also reduces visibility, and thus is only an optional constraint within REST. Layered The layered system style allows an architecture to be composed of hierarchical layers by constraining component behavior such that each component cannot "see" beyond the immediate layer with which they are interacting. Layers can be used to encapsulate legacy services and to protect new services from legacy clients, simplifying components by moving infrequently used functionality to a shared intermediary. Intermediaries can also be used to improve system scalability by enabling load balancing of services across multiple networks and processors.

REST Data Elements Resources and Resource Identifiers HTTP Method CRUD Uniform Interface (GET, PUT, POST, DELETE) Resource Oriented Simple and simple is beautiful HTTP Method CRUD Desc. POST CREATE Create - GET RETRIEVE Retrieve Safe,Idempotent,Cacheable PUT UPDATE Update Idempotent DELETE Delete Each Resource has a URI A "collection of resources" may, in itself, be a whole new resource. E.g. a search result collection. In a system for maintaining an employee contact, each user should have their own URI with an appropriate representation. The collection of all employees is another resource.  Dereferencing the URI: Agents may use a URI to access the referenced resource. safe : no side effect, The word "safe" means that if a given HTTP method is invoked, the resource state on the server remains unchanged The word "idempotent" means that, regardless of how many times a given method is invoked, the end result is the same. GET is always safe. No matter how many times you download this web page, the contents of it will not change due to your repeated downloads, since you cannot change the web page in that way. PUT is not safe, because if you store something on the server, then you are creating a new resource or you are modifying a resource. (Of course, one might modify a resource to contain the same representation, but that is a corner case and not the general rule we apply to PUT.) DELETE is clearly not safe. POST is not safe. However, if POST is used to send an e-mail, then why would it not be considered safe?  GET and HEAD are idempotent.  PUT is also idempotent. If you issue PUT 100 times, the resource state on the server is exactly the same as if you use the PUT method one time. DELETE is also idempotent. If you delete a resource once, it is gone. One cannot delete it again and, if one tried, it would have obviously not make state changes to the resource, since there is no resource to change.

REST Data Elements Representations HTML / XML / images / sounds / …

REST V.S. SOAP SOAP Simple Object Access Protocol RPC protocol that go through firewalls Communication protocol between applications A format for sending messages Applications running on different operating systems, with different technologies and programming languages Original RPC can not go through firewalls

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 - Applications running on different operating systems, with different technologies and programming languages

REST V.S. SOA 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. non-RESTful Web services often complain that they are too complex By contract, non-RESTful Web services easy to define new interfaces for remote interaction, often relying on introspection to extract the WSDL, since a minor change on the server (even an upgrade of the SOAP stack) can result in different WSDL and a different service interface Overlap?? SOA using RESTful Web Services

REST V.S. SOA SOA principles REST principles Correlation 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 Correlation REST is an architectural style that inherently helps to attain some of the basic SOA principles.

REST Introduction Q&A

REST Introduction Thank you!