Introduction to RESTful Web Services

REST stands for Representational State Transfer and is a newer addition to the web service family.

Roy Fielding coined the acronym REST in his Ph.D dissertation to describe an architectural style in the design of scalable web services.

REST is based on existing web-standards like the HTTP protocol and a set of standard http operations like POST, GET, PUT, and DELETE. In a REST-style service, a client might send a standard HTTP request to a web service and receives an appropriate response in a MIME-TYPE of their choice like XML, Text, JSON, user-defined etc. Also do remember that REST is not actually protocol specific, though people almost always use it with HTTP.

REST is also based on guidelines, than based on strict rules as in the case of SOAP web services. 

If you are new to web services, then you may first read about web services @ http://javajee.com/introduction-to-web-services-in-java. If you are not familiar with HTTP, I would recommend you go through the complete notes or atleast the initial notes available @ http://javajee.com/java-ee-web-components-part1-http-servlets-and-security.

REST follows resource oriented architecture as opposed to the popular service oriented architecture followed by SOAP web services. A resource is a source of representations, and a representation is data about the current state of a resource. You may read more @ http://javajee.com/resource-oriented-architecture.

 

More Background and Explanations

HTTP and Java EE Environment

REST web services are based on existing web-standards like the HTTP protocol and a set of standard http operations like POST, GET, PUT, and DELETE. So an understanding of the HTTP protocol and even the Java EE environment, will help you learn and understand REST better. Read more about HTTP, Servlets and Security @ http://javajee.com/java-ee-web-components-part1-http-servlets-and-security.

 

Web services and SOAP

Web services are services that can be located and invoked by client applications over a network (e.g. internet) automatically without human interaction.

Web services are different from web applications. While web applications are applications with web pages that reside on a server, primarily for use by humans, a web service is a server-based application component meant primarily for interaction with other programs. A web application might use a web service to retrieve and populate some data from another server without the end user knowing about it.

In SOAP based web services messages (requests and responses) are exchanged in an XML format called SOAP, unlike REST that uses existing HTTP protocol and support multiple data formats.

Read more about web services, SOAP and differences of SOAP and REST @ http://javajee.com/introduction-to-web-services-in-java.

 

Architecture style vs. Design style

REST is a software architecture style consisting of guidelines and best practices for creating scalable web services, and not a protocol that enforces a set of rules as in the case of SOAP.

An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context. Architectural patterns are similar to software design patterns, in that both of them provide a general, reusable solution to a commonly occurring problem. However architecture patterns have a broader scope than design patterns.

Architecture has a broader scope than design and hence architectural patterns have a broader scope than design patterns. Architectural decisions include which programming language to use, what design approach to use or which application server to use etc. along with many other things.

Based on the architecture, the designer will design the application usually using diagrams like UML and specifies how a developer should implement the application.

All design patterns take care of mainly code maintainability as their primary goal. Architectural patterns also address various issues in software engineering, such as computer hardware performance limitations, high availability and minimization of a business risk.

References and notes: 

http://en.wikipedia.org/wiki/Representational_state_transfer

http://en.wikipedia.org/wiki/Architectural_pattern

RESTful Java with JAX-RS by Bill Burke

RESTful Web Services by Leonard Richardson

Comments

nice and crisp introduction ...I would like to add definition for ROA  here..

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)

 

 

Was it useful?

Quick Notes Finder Tags

Activities (1) advanced java (1) agile (3) App Servers (6) archived notes (2) Arrays (1) Best Practices (12) Best Practices (Design) (3) Best Practices (Java) (7) Best Practices (Java EE) (1) BigData (3) Chars & Encodings (6) coding problems (2) Collections (15) contests (3) Core Java (All) (55) course plan (2) Database (12) Design patterns (8) dev tools (3) downloads (2) eclipse (9) Essentials (1) examples (14) Exception (1) Exceptions (4) Exercise (1) exercises (6) Getting Started (18) Groovy (2) hadoop (4) hibernate (77) hibernate interview questions (6) History (1) Hot book (5) http monitoring (2) Inheritance (4) intellij (1) java 8 notes (4) Java 9 (1) Java Concepts (7) Java Core (9) java ee exercises (1) java ee interview questions (2) Java Elements (16) Java Environment (1) Java Features (4) java interview points (4) java interview questions (4) javajee initiatives (1) javajee thoughts (3) Java Performance (6) Java Programmer 1 (11) Java Programmer 2 (7) Javascript Frameworks (1) Java SE Professional (1) JPA 1 - Module (6) JPA 1 - Modules (1) JSP (1) Legacy Java (1) linked list (3) maven (1) Multithreading (16) NFR (1) No SQL (1) Object Oriented (9) OCPJP (4) OCPWCD (1) OOAD (3) Operators (4) Overloading (2) Overriding (2) Overviews (1) policies (1) programming (1) Quartz Scheduler (1) Quizzes (17) RabbitMQ (1) references (2) restful web service (3) Searching (1) security (10) Servlets (8) Servlets and JSP (31) Site Usage Guidelines (1) Sorting (1) source code management (1) spring (4) spring boot (3) Spring Examples (1) Spring Features (1) spring jpa (1) Stack (1) Streams & IO (3) Strings (11) SW Developer Tools (2) testing (1) troubleshooting (1) user interface (1) vxml (8) web services (1) Web Technologies (1) Web Technology Books (1) youtube (1)