What is RESTFul Service | WebServices

What is RESTFul Service | WebServices

Postby rao-h2kinfosys » Tue Nov 12, 2013 6:41 pm

Protocol is a system of digital rules for message exchange within or between computers. When messages are exchanged through a computer network, the rules system is called a network protocol. communication; protocols are to communications as programming languages are to computations

HTTP is the protocol that allows for sending documents back and forth on the web.
A protocol is a set of rules that determines which messages can be exchanged, and which messages are appropriate replies to others.
Another common protocol is POP3, which you might use to fetch email on your hard disk.

In HTTP, there are two different roles: server and client. In general, the client always initiates the conversation; the server replies. HTTP messages are made of a header and a body.

RESTFul Services
REST stands for Representational State Transfer. (It is sometimes spelled "ReST".) and in virtually all cases, the HTTP protocol is used.
REST is an architecture style for designing networked applications. The idea is that, rather than using complex mechanisms such as CORBA, RPC or SOAP to connect between machines, simple HTTP is used to make calls between machines.

In many ways, the World Wide Web itself, based on HTTP, can be viewed as a REST-based architecture.

RESTful applications use HTTP requests to post data (create and/or update), read data (e.g., make queries), and delete data. Thus, REST uses HTTP for all four CRUD (Create/Read/Update/Delete) operations.
REST is a lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and Web Services (SOAP, WSDL, et al.). Later, we will see how much more simple REST is.
Despite being simple, REST is fully-featured; there's basically nothing you can do in Web Services that can't be done with a RESTful architecture.
REST is not a "standard". There will never be a W3C recommendataion for REST, for example. And while there are REST programming frameworks, working with REST is so simple that you can often "roll your own" with standard library features in languages like Perl, Java, or C#.
. REST as Lightweight Web Services
As a programming approach, REST is a lightweight alternative to Web Services and RPC.
Much like Web Services, a REST service is:
Platform-independent (you don't care if the server is Unix, the client is a Mac, or anything else),
Language-independent (C# can talk to Java, etc.),
Standards-based (runs on top of HTTP), and
Can easily be used in the presence of firewalls.

HTTP Verbs / HTTP methods

HTTP verbs tell the server what to do with the data identified by the URL.
Two of the most important HTTP verbs: GET and POST.

The PUT, GET, POST and DELETE methods are typical used in REST based architectures.
The following table gives an explanation of these operations.
GET defines a reading access of the resource without side-effects. The resource is never changed via a GET request,
PUT creates a new resource.
DELETE removes the resources. they can get repeated without leading to different results.
POST updates an existing resource or creates a new resource.

3. How Simple is REST?
Let's take a simple web service as an example: querying a phonebook application for the details of a given user. All we have is the user's ID.
Using Web Services and SOAP, the request would look something like this:
<?xml version="1.0"?>
<soap:body pb="http://www.acme.com/phonebook">
(The details are not important; this is just an example.) The entire shebang now has to be sent (using an HTTP POST request) to the server. The result is probably an XML file, but it will be embedded, as the "payload", inside a SOAP response envelope.
And with REST? The query will probably look like this:
Note that this isn't the request body -- it's just a URL. This URL is sent to the server using a simpler GET request, and the HTTP reply is the raw result data -- not embedded inside anything, just the data you need in a way you can directly use.
It's easy to see why Web Services are often used with libraries that create the SOAP/HTTP request and send it over, and then parse the SOAP response.
With REST, a simple network connection is all you need. You can even test the API directly, using your browser.
Still, REST libraries (for simplifying things) do exist, and we will discuss some of these later.
Note how the URL's "method" part is not called "GetUserDetails", but simply "UserDetails". It is a common convention in REST design to use nouns rather than verbs to denote simpleresources.
Posts: 49
Joined: Thu Jan 19, 2012 10:27 pm

Re: What is RESTFul Service | WebServices

Postby rao-h2kinfosys » Tue Nov 12, 2013 6:44 pm

Why we need multiple web services for each application in google
for example
Posts: 49
Joined: Thu Jan 19, 2012 10:27 pm

Re: What is RESTFul Service | WebServices

Postby rao-h2kinfosys » Tue Nov 12, 2013 6:47 pm

To avoid disturbing architecture of the each application?
TO avoid load.
make it simplicity.
Posts: 49
Joined: Thu Jan 19, 2012 10:27 pm

Re: What is RESTFul Service | WebServices

Postby suju12345 » Tue Nov 12, 2013 7:00 pm

Is accessing a website through internet a RESTful service? For example, each time you access your BOFA website for online banking, you send a request and get a response thrrough HTTP. Does it involve RESTful service?
Posts: 1
Joined: Tue Sep 03, 2013 7:07 pm

Re: What is RESTFul Service | WebServices

Postby rao-h2kinfosys » Tue Nov 12, 2013 7:12 pm

Yes.. It can be ..
But they might implemented Webservices using SOAP calls.
Unless we dig into the application we can not say bank of america is using soap or restful or CORBA or IBM MQ.

As a tester point of view , we send request and get response and validate the response... by comparing with DB and GUI
Posts: 49
Joined: Thu Jan 19, 2012 10:27 pm

Return to WebServices - SOA Testing

Who is online

Users browsing this forum: No registered users and 1 guest