Tutorial 06 – RESTful Web services

1. Compare and contrast Message oriented communication with resource oriented communication 

Message-Oriented Communication

Message-oriented communication is a way of communicating between processes. Messages, which correspond to events, are the basic units of data delivered. Tanenbaum and Steen classified message-oriented communication according to two factors---synchronous or asynchronous communication, and transient or persistent communication. In synchronous communication, the sender blocks waiting for the receiver to engage in the exchange. Asynchronous communication does not require both the sender and the receiver to execute simultaneously. So, the sender and recipient are loosely-coupled. The amount of time messages are stored determines whether the communication is transient or persistent. Transient communication stores the message only while both partners in the communication are executing. If the next router or receiver is not available, then the message is discarded. Persistent communication, on the other hand, stores the message until the recipient receives it.
A typical example of asynchronous persistent communication is Message-Oriented Middleware (MOM). Message-oriented middleware is also called a message-queuing system, a message framework, or just a messaging system. MOM can form an important middleware layer for enterprise applications on the Internet. In the publish and subscribe model, a client can register as a publisher or a subscriber of messages. Messages are delivered only to the relevant destinations and only once, with various communication methods including one-to-many or many-to-many communication. The data source and destination can be decoupled under such a model.
The Java Message Service (JMS) from Sun Microsystems provides a common interface for Java applications to MOM implementations. Since JMS was integrated with the recent version of the Java 2 Enterprise Edition (J2EE) platform, Enterprise Java Beans (EJB)---the component architecture of J2EE---has a new type of bean, the message-driven bean. The JMS integration simplifies the enterprise development, allowing a decoupling between components.
From Jungkee Kim's dissertation

Resource-oriented architecture (ROA)
A resource-oriented architecture (ROA) is the structural design supporting the internetworking of resources. A resource, in this context, is any entity that can be identified and assigned a uniform resource identifier (URI).
In information technology, architecture refers to the overall structure of an information system and the interrelationships of entities that make up that system. ROA is considered a RESTful architecture. REST (representational state transfer) is defined by Roy Fielding, co-author of the HTTP specification and co-founder of the Apache HTTP server project, as an architectural style that exploits the existing technology and protocols of the Web, including HTTP and XML.
Within the ROA concept, resources include not only IT infrastructure elements such as servers, computers and other devices, but also Web pages, scripts, and JSP/ASP pages, and other entities such as traffic lights.
Fielding’s doctoral dissertation, “Architectural Styles and the Design of Network-based Software Architectures,” identifies four essential concepts underlying the resource-oriented architecture:
  1. Resources
  2. Their names (URIs)
  3. Their representations
  4. The links between them.
and four properties:
  1. Addressability
  2. Statelessness
  3. Connectedness
  4. A uniform interface



2. Discuss the resource based nature of the REST style


The fundamental concept in any RESTful API is the resource. A resource is an object with a type, associated data, relationships to other resources, and a set of methods that operate on it. It is similar to an object instance in an object-oriented programming language, with the important difference that only a few standard methods are defined for the resource (corresponding to the standard HTTP GET, POST, PUT and DELETE methods), while an object instance typically has many methods.
Resources can be grouped into collections. Each collection is homogeneous so that it contains only one type of resource, and unordered. Resources can also exist outside any collection. In this case, we refer to these resources as singleton resources. Collections are themselves resources as well.
Collections can exist globally, at the top level of an API, but can also be contained inside a single resource. In the latter case, we refer to these collections as sub-collections. Sub-collections are usually used to express some kind of “contained in” relationship


3. Explain the meaning of “representations” in REST style
In REST-speak, a client and server exchange representations of a resource, which reflect its current state or its desired state. REST, or Representational state transfer, is a way for two machines to transfer the state of a resource via representations.

Image result for meaning of “representations” in REST style

 4. Discuss the constraints of REST, indicating their use in the domain of web
 

REST Constraints

REST constraints are design rules that are applied to establish the distinct characteristics of the REST architectural style. If you follow all constraints designed by the REST architectural style your systems is considered RESTful.
These constraints don't dictate what kind of technology to use; they only define how data is transferred between components and what benefits we get following the guidelines. Therefore, a RESTful system can be implemented in any networking architecture available.
  • Client-Server
  • Stateless
  • Cacheable
  • Uniform Interface
  • Layered System
  • Code On Demand (Optional)


Read more: http://mrbool.com/rest-architectural-elements-and-constraints/29339#ixzz5nsoNYys8


5. Identify contemporary examples of different types of implementations for the elements of REST style 

Connectors

Client                              HTTP library 

Server              .              Web Server API   

Cache                              Browser cache
                                           
Resolver                          bind (DNS lookup library)
                                                                                      
Tunnel                             SOCKS, SSL after HTTP  CONNECT                                                      
                                                                                                                                                                    Components

Origin Server              Apache httpd, Microsoft IIS

User Agent                 Browser like Netscape Navigator etc

Gateway                     Squid, CGI, Reverse Proxy

Proxy                         CERN Proxy, Netscape Proxy, Gauntlet

Data Elements

Resource                   Title of a movie from IMDb, A Flash movie from YouTube,                                   Images from Flickr etc
Resource Identifier     Standardized format of URI

Resource metadata     Source link, vary

Representation           Sequence of bytes, HTML document, archive document,                                    image document

Representation           Headers (media-type)
metadata

Control data               If-Modified-Since, If-Match




6. Explain how to define the API of RESTful web services using RESTful URLs 

A REST API defines a set of functions which developers can perform requests and receive responses via HTTP protocol such as GET and POST.
Because REST API’s use HTTP, they can be used by practically any programming language and easy to test (it’s a requirement of a REST API that the client and server are independent of each other allowing either to be coded in any language and improved upon supporting longevity and evolution).
The World Wide Web (WWW) is an example of a distributed system that uses REST protocol architecture to provide a hypermedia driven interface for websites. I’m saying hypermedia (instead of hypertext) as an expansion term to avoid confusion about the REST API supporting other formats to be provided not just HTML.




Comments

Popular Posts