A web service is a kind of software that is accessible on the Internet. It makes use of the XML messaging system and offers an easy to understand, interface for the end users.
What is REST and RESTful web services ?
REST stands for REpresentational State Transfer (REST) its a relatively new concept of writing web services which enforces a stateless client server design where web services are treated as resource and can be accessed and identified by there URL unlike SOAP web services which were defined by WSDL.
Web services written by apply REST Architectural concept are called RESTful web services which focus on System resources and how state of Resource should be transferred over http protocol to a different clients written in different languages. In RESTful web services http methods like GET, PUT, POST and DELETE can can be used to perform CRUD operations.
What is differences between RESTful web services and SOAP web services ?
Though both RESTful web series and SOAP web service can operate cross platform they are architecturally different to each other, here is some of differences between REST and SOAP:
1) REST is more simple and easy to use than SOAP
2) REST uses HTTP protocol for producing or consuming web services while SOAP uses XML.
3) REST is lightweight as compared to SOAP and preferred choice in mobile devices and PDA's.
4) REST supports different format like text, JSON and XML while SOAP only support XML.
5) REST web services call can be cached to improve performance.
What is Restlet framework ?
Restlet is leading RESTful web framework for Java applications is used to build RESTFul web services it has two part Restlet API and a Restlet implementation much like Servlet specification. There are many implementation of Restlet framework available you just need to add there jar in your classpath to use them. By using Restlet web framework you can write client and server.
You can use AJAX(Asynchronous JavaScript with XAML) and Direct Web Removing to consume web serives in web application. Both Eclipse and NetBeans also supported development of RESTFul services.
How to display custom error pages using RestFull web services ?
In order to customize error you need to extend StatusService and implement getRepresentation(Status, Request, Response) method with your custom code now assign instance of your CustomStatusService to appropriate "statusService property".
Which HTTP methods are supported by RestFull web services ?
Another common REST interview questioning RESTFul web service each Resource supports GET, POST, PUT and DELETE http methods.GET is mapped to represent(), POST - acceptRepresentation(), PUT- storeRepresentation and DELET for rmeoveRepresentation.
SOAP is an XML based protocol to transfer between computers.
Define WSDL?
It means Web Services Description Language. It is basically the service description layer in the web service protocol stock. The Service Description layer describes the user interface to a web service.
Differentiate between a SOA and a Web service?
SOA is a design and architecture to implement other services. SOA can be easily implemented using various protocols such as HTTP, HTTPS, JMS, SMTP, RMI, IIOP, RPC etc. While Web service, itself is an implemented technology. In fact one can implement SOA using the web service.
Discuss various approaches to develop SOAP based web service?
We can develop SOAP based web service with two different types of approaches such as contract-first and contract-last. In the first approach, the contract is defined first and then the classes are derived from the contract while in the later one, the classes are defined first and then the contract is derived from these classes.
If you have to choose one approach, then what will be your choice?
In my point of view, the first approach that is the contract-first approach is more feasible as compared to the second one but still it depends on other factors too.
What are the types of information included in SOAP header?
Header of SOAP contains information like that,
1. In SOAP header client should handle authentication and transaction.
2. The SOAP message should process by client.
3. EncodingStyle is also has in header.
SNo |
SOAP |
REST |
1 |
SOAP is a protocol |
REST is an architectural style. |
2 |
SOAP stands for Simple Object Access Protocol. |
REST stands for Representational State Transfer. |
3 |
SOAP can't use REST because it is a protocol. |
REST can use SOAP web services because it is a concept and can use any protocol like HTTP, SOAP. |
4 |
SOAP uses services interfaces to expose the business logic |
REST uses URI to expose business logic. |
5 |
JAX-WS is the java API for SOAP web services. |
JAX-RS is the java API for RESTful web services. |
6 |
SOAP defines standards to be strictly followed. |
REST does not define too much standards like SOAP. |
7 |
SOAP requires more bandwidth and resource than REST. |
REST requires less bandwidth and resource than SOAP. |
8 |
SOAP defines its own security. |
RESTful web services inherits security measures from the underlying transport. |
9 |
SOAP permits XML data format only. |
REST permits different data format such as Plain text, HTML, XML, JSON etc. |
10 |
SOAP is less preferred than REST. |
REST more preferred than SOAP. |
Very useful information Srikanth. Thanks a ton for compiling and putting all the useful information at one place.
ReplyDeleteIn continuation to the above blog: https://blogs.oracle.com/enterprisetechtips/entry/consuming_restful_web_services_with
ReplyDelete