Академический Документы
Профессиональный Документы
Культура Документы
Cesare Pautasso
Faculty of Informatics
University of Lugano, Switzerland
c.pautasso@ieee.org
http://www.pautasso.info
Web Sites (1992)
SOAP WSDL
Client XML Server
(HTTP)
2009-2010 - Cesare Pautasso, Erik Wilde 56
RESTful Web Services (2007)
PO-XML
RSS/Atom
JSON
WADL
Web
Client
HTTP Server
SOAP WSDL
Client XML Server
(HTTP)
2009-2010 - Cesare Pautasso, Erik Wilde 57
WS-* Standards Stack
AtomPub
RSS Atom
XML JSON
URI HTTP
MIME SSL/TLS
WS-* REST
WS-* REST
Middleware Architectural
Interoperability style for
Standards the Web
REST
WS-* Architectural
style for
Middleware the Web
Interoperability
Standards
Web Server
HTTP Client Database
Application Server
(Web Browser)
SELECT *
GET /book?ISBN=222 FROM books
WHERE isbn=222
POST /soap/endpoint
return getBook(222)
POST /soap/endpoint
return new Order()
POST /soap/endpoint
order.setCustomer(x)
Application Application
CICS
IMS
Web Enterprise
Applications Architectures
REST WS-*
Web Enterprise
Applications Architectures
REST
Enterprise
Architectures
CRUD Services
Web-friendly APIs
Mobile Services Real-time Services
Transactional Services
Composite Services
2009-2010 - Cesare Pautasso - 30.6.2010 80
Enterprise Use Cases
Enterprise
Architectures
WS-*
REST
Part of the debate is about how many
enterprise use cases can be covered with
REST as opposed to WS-*
2009-2010 - Cesare Pautasso - 30.6.2010 81
Does REST support X?
Service Description Service Composition
Security Transactions
Asynch Messaging Semantics
Reliable Messaging SLAs
Stateful Services Governance
(*) Each client request to the server must contain all information needed to understand the request, without referring to any
stored context on the server. Of course the server stores the state of its resources, shared by all clients.
REST WS-*
Decisions 17 14
Alternatives 27 35
REST WS-*
Decisions 5 12
Alternatives 16 32
REST WS-*
Decisions 17 14
Alternatives 27 35
REST WS-*
Decisions 5 12
Alternatives 16 32
URI Design
Resource Interaction Semantics
Payload Format
Service Description
Service Composition
2009-2010 - Cesare Pautasso, Erik Wilde 89
Measuring Complexity
REST WS-*
Decisions 5 12
Alternatives 16 32
REST WS-*
Decisions 12 2
Payload Format
Data Representation Modeling
REST WS-*
Decisions 12 2
REST WS-*
Do-it-yourself 5 0
Alternatives
REST WS-*
Decisions 12 2
REST WS-*
Do-it-yourself 5 0
Alternatives
Resource Identification
Resource Relationship
Reliability
Transactions
Service Discovery
2009-2010 - Cesare Pautasso, Erik Wilde 93
Freedom of Choice (>1 Alternative)
Freedom from Choice (=1 Alternative)
File Transfer
Shared Data
Procedure Call
Remote Procedure Call
Message Bus
Events
2010 - Cesare Pautasso 97
RPC
Call
Remote Procedure Call
Write
Copy File Transfer
(Hot Folder)
Transferring files does not require
Watch to modify components
A component writes a file, which is
Read
then copied on a different host,
and fed as input into a different
component
The transfers can be batched with
a certain frequency
Create
Read Shared Database
Publish
Subscribe Message Bus
RPC ESB
WS-*
WWW
REST
2010 - Cesare Pautasso 102
Web (RESTful Web services)
Get Put
Delete
Post Web
The Web is the connector used in the REST (Representational State
Transfer) architectural style
Components may reliably transfer state among themselves using the
GET, PUT, DELETE primitives. POST is used for unsafe interactions.
In Out
Rd Tuple Space
A tuple space acts like a shared database, but offers a much simpler
set of primitives and persistence guarantees
Components can write tuples into the space (with the Out operation)
or read tuples from it (with the Rd operation).
Components that read tuples can also atomically take them out of
the space (with the In operation)
Extensions for the connector are available that support different
kinds of synchronization, in addition to the basic data flow primitives
Spring Semester 2010
Software Architecture and Design 104
Comparison Conclusion
You should focus on whatever solution gets
the job done and try to avoid being religious
about any specific architectures or
technologies.
WS-* has strengths and weaknesses and will
be highly suitable to some applications and
positively terrible for others.
Likewise with REST.
The decision of which to use depends entirely
on the application requirements and
constraints.
We hope this comparison will help you make
the right choice.
Cesare Pautasso
Faculty of Informatics
University of Lugano, Switzerland
c.pautasso@ieee.org
http://www.pautasso.info
REST Architectural Elements
Client/Server Layered Stateless Communication Cache
Proxy
User Agent Origin Server
Gateway
Adding Caching
HTTP HTTP
Caching Caching
User Agent Origin Server
HTTP HTTP
Client Proxy Origin Server
A proxy is chosen by the Client (for caching, or access control)
HTTP HTTP
Client Gateway Origin Server
The use of a gateway (or reverse proxy) is imposed by the server
Origin Server
2009-2010 - Cesare Pautasso, Erik Wilde 111
BPEL and WSDL 2.0
WSDL 2.0 HTTP Binding can wrap RESTful Web Services
(WS-BPEL 2.0 does not support WSDL 2.0)
PUT
<onGet>
<Put R> GET
R
P
<Get S> POST
DELETE
GET </onGet>
<onDelete> PUT
POST
DELETE <Post R>
<Delete S>
GET
S
</onDelete>
</Resource> POST
DELETE
Cache
Proxy/Gateway
Origin
Client
Clients Server
Cache
Proxy/Gateway Origin
Server
Clients
Proxy/Gateway Origin
Server
Clients
DELETE
PUT
GET
C
DELETE DELETE
POST PUT PUT
GET
R GET
S
POST POST
R S
State R State S
C State C
R S
State R State S
Composite GET
R PUT
Representation
POST
S
C
GET
POST
LinkR
LinkS
Client Origin
Servers
A composite representation is interpreted by
the client that follows its hyperlinks and
aggregates the state of the referenced
component resources
2010 - Cesare Pautasso 123
Bringing it all together
Composite
Representation
Composite Origin
RESTful Servers
service
Client Origin
Servers
Composite
Representation
Composite Origin
RESTful Servers
service
Client Origin
Servers
DELETE
PUT
GET
C
DELETE DELETE
POST PUT PUT
GET
R GET
S
POST POST
DELETE
GET
C
DELETE
POST PUT
GET
R GET
S
POST
DM DELETE
GET
G
LinkG
GET
C
LinkC DELETE
POST PUT
LinkD
GET
R GET
S
POST
RESTful API
APIs
GET
POST
GET
Mashup
REST
Composition
GET
C
DELETE DELETE
POST PUT PUT
GET
R GET
S
POST POST
GET
C
GET
R GET
S
Composite
API
Representation
Composite Origin
RESTful Servers
UI
service
Reusable
Client Origin services vs.
Servers Reusable
Widgets
2010 - Cesare Pautasso 135
Single-Origin Sandbox
Can you always do this
from a web browser?
Composite
Representation
Composite Origin
RESTful Servers
service
Client Origin
Servers
UI Mashup
REST API
Composition
Reusable
Situational Service
Sandboxed
GET http://www.jopera.org/
2010 - Cesare Pautasso 139
References
Roy Fielding, Architectural Styles and the Design of Network-based
Software Architectures, PhD Thesis, University of California, Irvine,
2000
Leonard Richardson, Sam Ruby, RESTful Web Services, OReilly,
May 2007
Jim Webber, Savas Parastatidis, Ian Robinson, REST in Practice:
Hypermedia and Systems Architecture, OReilly, 2010
Subbu Allamaraju, RESTful Web Services Cookbook: Solutions for
Improving Scalability and Simplicity, OReilly, 2010
Stevan Tilkov, HTTP und REST, dpunkt Verlag, 2009,
http://rest-http.info/