Interview Ques
Interview Ques
SOAPUI tool for SOAP WS and Firefox "poster" plugin for RESTFUL services.
5) Mention whether you can use GET request instead of PUT to create a
resource?
No, you are not supposed to use PUT for GET. GET operations should only have
view rights, while PUT resource is used for updating a data.
Resources are identified by logical URLs; it is the key element of a RESTful design.
Unlike, SOAP web services in REST, you view the product data as a resource and
this resource should contain all the required information.
7) Mention what is the difference between AJAX and REST?
AJAX REST
In Ajax, the request are sent to the server REST have a URL structure and a
by using XMLHttpRequest objects. The request/response pattern the revolve
response is used by the JavaScript code to around the use of resources
dynamically alter the current page REST is a type of software architecture
Ajax is a set of technology; it is a technique and a method for users to request data
of dynamically updating parts of UI without information from servers
having to reload the page REST requires the interaction between
Ajax eliminates the interaction between the customer and server
customer and server asynchronously
REST is stateless, therefore the SERVER has no state (or session data)
With a well-applied REST API, the server could be restarted between two
calls as every data is passed to the server
Web service mostly uses POST method to make operations, whereas REST
uses GET to access resources
Shared database
Batch file transfer
Invoking remote procedure (RPC)
Swapping asynchronous messages over a message oriented middle-ware
(MOM)
"PUT" puts a file or resource at a particular URI and exactly at that URI. If there is
already a file or resource at that URI, PUT changes that file or resource. If there is no
resource or file there, PUT makes one
POST sends data to a particular URI and expects the resource at that URI to deal
with the request. The web server at this point can decide what to do with the data in
the context of specified resource
PUT is idempotent meaning, invoking it any number of times will not have an impact
on resources.
However, POST is not idempotent, meaning if you invoke POST multiple times it
keeps creating more resources
11) Mention which markup language can be used in restful web api?
JSON and XML are the two markup language that can be used in restful web api
12) Mention what is the difference between RPC or document style web
services? How you determine to which one to choose?
In document style web services, we can transport an XML message as part of SOAP
request which is not possible in RPC style web service. Document style web service
is most appropriate in some application where XML message behaves as document
and content of that document can alter and intention of web service does not rely on
the content of XML message.
Both JAX-WS and JAX-RS are libraries (APIs) for doing communication in various
ways in Java. JAX-WS is a library that can be used to do SOAP communication in
JAVA, and JAX-RS lets you do the REST communication in JAVA.
14) List out the tools or API for developing or testing web api?
SOAP REST
SOAP is a Rest is a
protocol service
through architecture
which two and design
computer for network-
communica based
tes by software
sharing architecture
XML s
document REST
SOAP supports
permits many
only XML different
SOAP data
based formats
reads REST
cannot be reads can
cached be cached
SOAP is A REST
like custom client is
desktop more like a
application, browser; it
closely knows how
connected to
to the standardize
server d methods
SOAP is and an
slower than application
REST has to fit
It runs on inside it
HTTP but REST is
envelopes faster than
the SOAP
message It uses the
HTTP
headers to
hold meta
information
Q #6) What are the core components of the HTTP request and HTTP response?
Answer: The core components under HTTP Request are:
Verb: Includes methods like GET, PUT, POST, etc.
Uniform Resource Identifier for identifying the resources available on the
server.
HTTP Version for specifying the HTTP version.
HTTP Request header for containing the information about the data.
HTTP Request body that contains the representation of the resources in use.
The core components under HTTP Response are:
Request Code: This contains various codes that determine the status of the
server response.
HTTP Version for specifying the HTTP version.
HTTP Response header for containing the information about the data.
HTTP Response body that contains the representation of the resources in
use.
Q #7) Explain the term ‘Statelessness’ with respect to RESTful WEB service.
Answer: In REST, ST itself defines State Transfer and Statelessness means
complete isolation. This means, the state of the client’s application is never stored on
the server and is passed on.
In this process, the clients send all the information that is required for the server to
fulfill the HTTP request that has been sent. Thus every client requests and the
response is independent of the other with complete assurance of providing the
required information.
Every client passes a ‘session identifier’ which also acts as an identifier for each
session.
1. What is REST?
REST is an architectural style for developing web services which exploit the
ubiquity of HTTP protocol and uses the HTTP method to define actions. It
revolves around resource where every component being a resource that can be
accessed through a shared interface using standard HTTP methods.
In REST architecture, a REST Server provides access to resources and REST
client accesses and makes these resources available. Here, each resource is
identified by URIs or global IDs, and REST uses multiple ways to represent a
resource, such as text, JSON, and XML. XML and JSON are nowadays the most
popular representations of resources.
REST?
GET is only used to request data from a specified resource. Get requests can
be cached and bookmarked. It remains in the browser history and haS length
restrictions. GET requests should never be used when dealing with sensitive
data.
POST is used to send data to a server to create/update a resource. POST
requests are never cached and bookmarked and do not remain in the browser
history.
PUT replaces all current representations of the target resource with the
request payload.
DELETE removes the specified resource.
OPTIONS is used to describe the communication options for the target
resource.
HEAD asks for a response identical to that of a GET request, but without the
response body.
12. Which purpose does the OPTIONS method serve for the RESTful
Webservices?
The OPTIONS Method lists down all the operations of a web service supports. It
creates read-only requests to the server.
13. What is URI? What is the main purpose of REST-based web services
and what is its format?
URI stands for Uniform Resource Identifier. It is a string of characters
designed for unambiguous identification of resources and extensibility via the
URI scheme. The purpose of a URI is to locate a resource(s) on the server
hosting of the web service.
A URI’s format
is <protocol>://<service-name>/<ResourceType>/<ResourceID>.
15. What is the upper limit for a payload to pass in the POST method?
<GET> appends data to the service URL. But, its size shouldn’t exceed the
maximum URL length. However, <POST> doesn’t have any such limit.
So, theoretically, a user can pass unlimited data as the payload to POST method.
But, if we consider a real use case, then sending POST with large payload will
consume more bandwidth. It’ll take more time and present performance
challenges to your server. Hence, a user should take action accordingly.
16. What is the caching mechanism?
Caching is just the practice of storing data in temporarily and retrieving data
from a high-performance store (usually memory) either explicitly or implicitly.
When a caching mechanism is in place, it helps improve delivery speed by
storing a copy of the asset you requested and later accessing the cached copy
instead of the original.