|
| 1 | +Web Services |
| 2 | +--- |
| 3 | + |
| 4 | +List questions: |
| 5 | + |
| 6 | +1. [What is a Web Service?](#what-is-a-web-service-) |
| 7 | +1. [What are the advantages of Web Services?](#what-are-the-advantages-of-web-services-) |
| 8 | +1. [What are different types of Web Services?](#what-are-different-types-of-web-services-) |
| 9 | +1. [What is REST Web Services?](#what-is-rest-web-services-) |
| 10 | +1. [What are advantages of REST web services?](#what-are-advantages-of-rest-web-services-) |
| 11 | +1. [What are disadvantages of REST web services?](#what-are-disadvantages-of-rest-web-services-) |
| 12 | +1. [What is a Resource in Restful web services?](#what-is-a-resource-in-restful-web-services-) |
| 13 | +1. [What are different HTTP Methods supported in Restful Web Services?](#what-are-different-http-methods-supported-in-restful-web-services-) |
| 14 | +1. [Can we maintain user session in web services?](#can-we-maintain-user-session-in-web-services-) |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +1. ##### What is a Web Service? [⤴](#web-services-) |
| 19 | + |
| 20 | + Web Services work on client-server model where client applications can access web services over the network. Web services provide endpoint URLs and expose methods that can be accessed over network through client programs written in java, shell script or any other different technologies. |
| 21 | +Web services are stateless and doesn’t maintain user session like web applications. |
| 22 | + |
| 23 | +1. ##### What are the advantages of Web Services? [⤴](#web-services-) |
| 24 | + |
| 25 | + Some of the advantages of web services are: |
| 26 | + |
| 27 | + - Interoperability: Web services are accessible over network and runs on HTTP/SOAP protocol and uses XML/JSON to transport data, hence it can be developed in any programming language. Web service can be written in java programming and client can be PHP and vice versa. |
| 28 | + - Reusability: One web service can be used by many client applications at the same time. |
| 29 | + - Loose Coupling: Web services client code is totally independent with server code, so we have achieved loose coupling in our application. |
| 30 | + - Easy to deploy and integrate, just like web applications. |
| 31 | + - Multiple service versions can be running at same time. |
| 32 | + |
| 33 | +1. ##### What are different types of Web Services? [⤴](#web-services-) |
| 34 | + |
| 35 | + There are two types of web services: |
| 36 | + |
| 37 | + - SOAP Web Services: Runs on SOAP protocol and uses XML technology for sending data. |
| 38 | + - Restful Web Services: It’s an architectural style and runs on HTTP/HTTPS protocol almost all the time. REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services. |
| 39 | + |
| 40 | +1. ##### What is REST Web Services? [⤴](#web-services-) |
| 41 | + |
| 42 | + REST is the acronym for REpresentational State Transfer. REST is an architectural style for developing applications that can be accessed over the network. REST architectural style was brought in light by Roy Fielding in his doctoral thesis in 2000. |
| 43 | + |
| 44 | + REST is a stateless client-server architecture where web services are resources and can be identified by their URIs. Client applications can use HTTP GET/POST methods to invoke Restful web services. REST doesn’t specify any specific protocol to use, but in almost all cases it’s used over HTTP/HTTPS. When compared to SOAP web services, these are lightweight and doesn’t follow any standard. We can use XML, JSON, text or any other type of data for request and response. |
| 45 | + |
| 46 | +1. ##### What are advantages of REST web services? [⤴](#web-services-) |
| 47 | + |
| 48 | + Some of the advantages of REST web services are: |
| 49 | + |
| 50 | + - Learning curve is easy since it works on HTTP protocol |
| 51 | + - Supports multiple technologies for data transfer such as text, xml, json, image etc. |
| 52 | + - No contract defined between server and client, so loosely coupled implementation. |
| 53 | + - REST is a lightweight protocol |
| 54 | + - REST methods can be tested easily over browser. |
| 55 | + |
| 56 | +1. ##### What are disadvantages of REST web services? [⤴](#web-services-) |
| 57 | + |
| 58 | + Some of the disadvantages of REST are: |
| 59 | + |
| 60 | + - Since there is no contract defined between service and client, it has to be communicated through other means such as documentation or emails. |
| 61 | + - Since it works on HTTP, there can’t be asynchronous calls. |
| 62 | +Sessions can’t be maintained. |
| 63 | + |
| 64 | +1. ##### What is a Resource in Restful web services? [⤴](#web-services-) |
| 65 | + |
| 66 | + Resource is the fundamental concept of Restful architecture. A resource is an object with a type, relationship with other resources and methods that operate on it. Resources are identified with their URI, HTTP methods they support and request/response data type and format of data. |
| 67 | + |
| 68 | +1. ##### What are different HTTP Methods supported in Restful Web Services? [⤴](#web-services-) |
| 69 | + |
| 70 | + Restful web services supported HTTP methods are – GET, POST, PUT, DELETE and HEAD. |
| 71 | + |
| 72 | +1. ##### Can we maintain user session in web services? [⤴](#web-services-) |
| 73 | + |
| 74 | + Web services are stateless so we can’t maintain user sessions in web services. |
| 75 | + |
| 76 | +References |
| 77 | +--- |
| 78 | +1. [web services interview questions](http://www.journaldev.com/9193/web-services-interview-questions-soap-restful) |
0 commit comments