2. What is this talk about?
An introduction to the REST architectural style...
A different way of looking at
Service Oriented Computing
3. What is this talk about?
An introduction to the REST architectural style...
A different way of looking at
Service Oriented Computing
...and some ideas to foster discussion for
finding new research directions! ☺
5. Classic SOA
Service
• Web-services broker
• WSDL
Register Search
• SOAP
• UDDI Service
provider Request
Service
requester
6. Classic SOA
Service
• Web-services broker
UDDI
• WSDL
Register WSDL WSDL Search
• SOAP
• Service Service
SOAP
UDDI
provider Request requester
Web Service
7. Web(?) services
“Definition: A Web service is a software system
designed to support interoperable machine-to-machine
interaction over a network. It has an interface
described in a machine-processable format (specifically
WSDL). Other systems interact with the Web service
in a manner prescribed by its description using SOAP
messages, typically conveyed using HTTP with an XML
serialization in conjunction with other Web-related
standards.”
[W3C, http://www.w3.org/TR/ws-arch/#whatis]
9. SOAP
• Was “Simple Object Access Protocol”,
sometimes referred as SOA-Protocol
• Simply an XML-based messaging protocol
used mainly as an RPC protocol
10. UDDI
• Universal Description, Discovery and
Integration
• Platform-independent, XML-based registry
for business services
• Accessible via SOAP, provides WSDLs
(... and other complementary information)
15. @PHDThesis{REST,
Author = {Roy Thomas Fielding},
Title = {Architectural styles and the design of
network-based software architectures},
Year = {2000},
Publisher = {University of California, Irvine},
}
2000
16. What is REST?
• REpresentational State Transfer
• An architectural style for distributed
hypermedia systems
• A Uniform-Layered-Client-Cache-Stateless-
Server with Code on Demand architectural
style [Fielding2000, Figure 5-8]
18. What is REST?
• •Data elements
Resources and identifiers
• Representations
•
•
Metadata
Control data • •Components
User agent
• •Connectors
Client
•
•
Origin server
Gateway
• Server
• Proxy
• Cache
• Resolver
• Tunnel
19. Data elements
• Resources (and resource identifiers)
“Any concept that might be the target of author’s hypertext”, addressable by well
defined resource identifiers and associated to one or more representations
• Representations
A machine-understandable description of the current resource state; typically a
sequence of bytes in a well defined format known as the media-type
• Metadata
Additional data used to provide additional information about a representation, that
cannot be extrapolated from the representation itself
• Control data
Information describing the purpose of a message exchanged between components
20. Connectors
• Client connector
Initiates communication and performs requests
• Server connector
Listens for connections and replies to requests
• Cache connector
Associated to a client or server connector, saves replies to requests for a later usage
• Resolver
Translates resource identifiers to network addresses for the actual communication
• Tunnel
Relays communication across communication boundaries
21. Components
• User agent
Uses a client connector to perform requests and is the final recipient of responses
• Origin server
Uses a server connector for processing requests and providing responses. It is the
source of resource representations and is the entity governing their state
• Proxy
An intermediary entity selected by a client for performance enhancement, data
translation, etc.
• Gateway
An intermediary entity imposed by the network or by the origin server with similar
functions as a proxy
22. REST and the Web
• URLs provide a consistent and accepted
naming scheme for addressing resources
• HTTP provides the uniform interface for
accessing resources
• Standard formats provide widely
understood representations
23. Web Data Elements
REST data element Web instantiation
Resource identifier URL
Representation HTML, JPG, ...
Representation medatada Media-type, last-modification time
Control data if-modified-since, cache-control
24. Web Connectors
REST connector Web instantiation
Client libwww, libwww-perl
Server libwww, Apache API
Cache Browser cache, Akamai
Resolver Bind (DNS)
Tunnel SOCKS, SSL
25. Web Components
REST component Web instantiation
Origin server Apache httpd, Microsoft IIS
User agent Firefox, IE, Safari, ...
Gateway Squid, CGI, ...
Proxy CERN proxy, Gauntlet
27. REST Key principles
• Addressability
• Uniform interface
• Stateless communication
• Hypermedia As The Engine Of Application
State
28. Addressability
• Using resource URIs to expose interesting
part of system data and state
• All the pages talking about me: http://
www.google.com/search?q=Fabio+Mancinelli
• Introduces nice properties (e.g., easy
communication, bookmarking, caching,
chaining...)
29. Uniform interface
• A single interface is used to access and
manipulate resources
• Well defined semantics
• HTTP is the uniform interface to the web
Verb (method) Semantics Property
GET Retrieve a representation Safe + Idempotent
PUT Store a representation Idempotent
DELETE Delete a resource Idempotent
POST Problems here! A backdoor/mismatch
32. Twisted!
OrderManagementService
+ getOrders()
+ submitOrder()
+ getOrdersForCustomers()
+ updateOrder()
+ addOrderItem()
CustomerManagementService
+ cancelOrder()
+ getCustomers()
+ addCustomer()
+ getCustomerDetail()
+ updateCustomer()
+ deleteCustomer()
[Example taken from http://www.infoq.com/articles/rest-introduction by Stefan Tilkov]
33. Twisted!
/orders
GET - List all orders
PUT
/customers/{id}/orders
POST - Add new order
DELETE
GET - Get all orders for customer
PUT
HTTP /orders/{id} POST - Add order
DELETE - Cancel all customer orders
GET GET - Get order details
PUT PUT - Update order
POST POST - Add item /customers/{id}
DELETE DELETE - Cancel order
GET - Get customer detail
PUT - Update customer
/customers POST
DELETE - Delete customer
GET - List all customers
PUT - Update customer
POST
DELETE - Delete customer
[Example taken from http://www.infoq.com/articles/rest-introduction by Stefan Tilkov]
34. Statelessness
• No conversational state: every request
carries all the information needed to its
fulfillment
• Implies that every possible server state is
exposed as a resource
35. HATEOAS (!)
• Addressability enables clients to follow
links to “next states”
• http://www.google.fr/search?q=Fabio
+Mancinelli&start=2
39. Pipes
for i in $(seq 13830 21829); do
egrep "^From:" $i | awk '{print $2 $3}';
done
| sort | uniq -c | sort -nr | head -n15
[Extract the Top-15 most active people on the eclipse.newcomer newsgroup during the last year
http://eclipsewebmaster.blogspot.com/2008/02/newcomer-newsgroups-top-15.html]
43. A “Pervasive Web”
• From objects providing services to
resources representing things (...and their
state)
• Applying REST principles to the pervasive
world
• Make pervasive contexts be part of “The
Web” and not running on top of it.
47. Challenges
• KISS: Keep It Sweet & Simple!
• New architectures and protocols
(extensions) for being pervasively RESTful:
Is “The Web” enough?
• Reconcile pervasive world’s peculiar
characteristics with a RESTful setting
• Overcoming REST limitations