Ecs781p 4 Rest
Ecs781p 4 Rest
Ecs781p 4 Rest
CLOUD COMPUTING
INTRODUCTION TO RESTFUL
SERVICES
RESTful Services
RESTful Services
A stub may simulate the behavior of existing code (such as a procedure on a remote machine) or be a
temporary substitute for yet-to-be-developed code.
Stub and Driver
RPC at work
2. Stub marshals params to network message
Marshalling = put parameters in a form suitable for transmission over a
network (serialized)
RPC at work
3. Network message sent to server
4. Receive message: send it to server stub
RPC at work
5. Unmarshal parameters, call server function
6. Return from server function
RPC at work
7. Marshal return value and send message
8. Transfer message over network
RPC at work
9. Receive message
10. Unmarshall return value to client
Cloud Computing
RPC
Web services
REST
Cloud Computing
Web Services
Web Services
A bit of History: RPC
Web Services
RESTful Services
2https://www.w3schools.com/xml/xml whatis.asp
Cloud Computing
RESTful Services
IETF
publications
over time
Heavy standardisation in the Internet
(IETF)
Cloud Computing
RESTful Services
RESTful Services
Cloud Computing
RESTful Services
Cloud Computing
RESTful Services
Web Services – Critique:
- Very complex, redundant with HTTP functions
- Overly ambitious, too many standards,
interoperability issues
- Very inefficient for simple scenarios
- Big backlash from developers
That said:
➢ Still in use by large companies
➢ Comprehensive security features
Contents
RPC
Web services
REST
Cloud Computing
REST
Web Services
A bit of History: RPC
Web Services
RESTful Services
RESTful applications
➢ REpresentational State Transfer.
- PhD thesis from one of the creators of HTTP:
Roy Fielding, 2000
➢ Client-server architecture for distributed
applications
➢ Not a specific protocol; a set of guidelines
➢ Http is perfectly suited for RESTful services
➢ Its popularity exploded in the late 2000s as a
reaction to WebServices / SOA
Cloud Computing
REST
Web Services
A bit of History: RPC
Web Services
REST
Web Services
A bit of History: RPC
Web Services
REST
Web Services
A bit of History: RPC
Web Services
RESTful Services
REST Resources
➢ All information is abstracted as resources
➢ Resources are stored at the server, they are
stateful
➢ Resources have identity (can be referenced)
➢ Resources have a uniform access interface
➢ Client and server exchange resource
representations (eg XML or JSON format)
Cloud Computing
REST
Web Services
A bit of History: RPC
REST Resources have identity
Web Services
➢ A resource is identified by its URI
RESTful Services
➢ URI: Uniform Resource Identifier
➢ scheme:
scheme://host:port/path?queryString#fragment
➢ URLs act as templates
- Part of the address represents the type of the
resource, and the other part the individual
resource
- http://phones.com/whitepages/userPhone
➢ A URI can be further classified as a locator, a
name, or both.
➢ “Uniform Resource Locator” (URL): in addition
to identifying a resource, provide a means of
locating the resource by describing its primary
access mechanism (e.g., its network “location”).
Cloud Computing
REST
Web Services
A bit of History: RPC
Web Services
RESTful Services
Resource representation
➢ Flexible format (XML, Json, something else)
- Content-Type: header
➢ JSON: JavaScript Object Notation, Javascript
mechanism for serialising objects
- Has become widely used, concise syntax,
flexible
➢ XML: eXtensible Markup Language
- Powerful
- XML Schemas allow to verify correct formats
Cloud Computing
REST: Resource
Web Services
A bit of History: RPC
Web Services
representation
RESTful Services
Cloud Computing
REST
Web Services
A bit of History: RPC
Web Services
RESTful Services
The REST uniform Service interface
➢ Every resource has the same interface
(Analogous to Database CRUD)
- GET: Request a representation of the identified
resource
- POST: Create a new resource according to the
attached representation
- PUT: Update the representation of a resource
according to the attached representation
- DELETE: Delete the identified resource
* demo: browser + curl
Cloud Computing
REST
Web Services
A bit of History: RPC
Web Services
RESTful Services
* demo: https://restcountries.eu/
REST
Web Services
A bit of History: RPC
Web Services
RESTful Services
* demo: https://restcountries.eu/
Cloud Computing
REST
Web Services
A bit of History: RPC
Web Services
REST
Web Services
A bit of History: RPC
Web Services
RESTful Services
REST
Web Services
A bit of History: RPC
Web Services
RESTful Services
Other Resources
Web Services
A bit of History: RPC
Web Services
RESTful Services