A Web Service is a software that is available over the internet. Attending a web service interview can be quite intimidating. Hence, through the course of this blog, we bring to you the top 82 Web Services Interview Questions and Answers that will help you crack your interviews.
Top Web Services Interview Questions
1. What is a web service?
- A web service is a software available over the internet.
- It uses a programmable module with standardized formats or protocols to establish communication between a client and a server through the network.
- It makes it possible to exchange data/information between two different web applications with the help of an XML messaging system.
2. What is the difference between a web application and a web service?
- Web service is a method of communication between two different web applications through the network.
- Web applications are computer programs or software that use web browsers as their clients and web services to perform certain tasks.
- A web application has a GUI (Graphical user interface).
- Web services need not have a user interface since it is meant for web applications as a component.
- Web applications are used by people.
- Web services are meant for computer machines.
- A web service is a collection of standard formats or protocols for exchanging information/data between two web applications.
- A web application can be written in various languages such as Java, PHP, Python, .net, etc.
3. How do web services work?
- In the above diagram, communication between the client and the server is happening over the network through the internet.
- First, the client requests the server for accessing the web services where the actual web services are hosted. Then, the server responds to this request and provides the web service to the client.
- These requests are made through remote procedure calls(RPC). RPC calls are made to the methods hosted by a specific web service.
- Web services utilize the hypertext transfer protocol (HTTP) as its medium and a common format mainly XML (Extensible markup language) for the exchange of messages. In this manner, two applications written in different languages can talk to each other.
- There are open standards defined in which a web service is implemented.
- These open standards are defined by W3C (world wide web consortium). One of the web service open standards is SOAP (Simple Object Access Protocol).
- The message transferred between the applications has a defined format called a SOAP message.
4. Can you give one real-world example of a web service?
- Google search API is a real-world example of a web service.
- Google also provides a SOAP-based API for accessing its resources in a model for Web services. The Google API can be used to access several different services, such as executing a search on Google, receiving the results, requesting a spelling suggestion, and fetching a cached page. Another example is amazon web services.
5. Why do we use web services?
Web services make it easier for two applications written in different languages to communicate with each other. They use a common language called Extensible markup language or XML for sending information between applications. Web services are used to make the application platform-independent.
6. What is the purpose of a web service?
The purpose of a web service is to provide its functionalities to web applications via HTTP so that an application in java can talk to another application that may be written in Node.js over the network. Therefore, it needs a common format, XML to transfer the functionalities one application offers to another application.
7. Name the different components of a web service?
A web service has three main components:
8. What are the characteristics of web services?
- Application-to-application interactions.
- Loose coupling.
- Availability over the web/internet.
- Use of HTTP medium.
- Common XML format.
- Support Remote Procedure calls(RPC).
- Support data/information exchange.
9. What is XML and why is it used in a web service?
XML stands for Extensible Markup Language which is a markup language that defines a set of rules/standards for encoding documents in a special format. XML was designed to store and transport data. XML was designed to be both human- and machine-readable. It is used in a web service as a common language that both a client requesting service and a server responding to that request can understand.
10. How do you decide which type of web service to use?
- If both the client and server have an agreement on the exchange format then SOAP 1.2 gives the rigid specifications for this type of interaction. An example is an online purchasing site in which users add items to a cart before the payment is made.
- If there is a requirement that the client needs a guaranteed level of reliability and security then we can use the OAP standard of SOAP 1.2 that has a lot of features and security.
- Also, SOAP messages are bulky and hence consume a greater bandwidth, REST should be used where network bandwidth is a constraint.
- If there is no need to maintain a state of information from one request to another then REST should be used.
- Programming of REST web services and implementation is comparatively easier than SOAP.
- Also, when there is a need to cache multiple requests then REST is preferred.
11. What do you understand about a web service protocol stack?
It is a stack of various protocols that can be utilized to explore and execute web services. It is used for the transfer of XML messages. The stack consisted of four layers namely the service transport layer, XML messaging layer, service description layer, and service discovery layer.
12. What are the different layers of the protocol stack?
- Service transport layer
- XML messaging layer
- Service description layer
- Service discovery layer
13. What is the function of the service transport layer of a protocol stack?
The function of the service transport layer of a protocol stack is exchanging messages between different applications. It has the following protocols :
- HyperText Transport Protocol (HTTP)
- Simple Mail Transfer Protocol (SMTP)
- File Transfer Protocol (FTP)
- Blocks Extensible Exchange Protocol (BEEP).
14. What is the function of the XML messaging layer of the protocol stack?
The function of the XML messaging layer of the protocol stack is encoding messages in a common format i.e XML to make it understandable to both of the communicating applications. It has the following protocols:
15. What is the function of the service description layer of the protocol stack?
The function of the service description layer of the protocol stack is to describe the public interface to a particular web service. It uses the Web Service Description Language (WSDL).
16. What is the function of the service discovery layer of the protocol stack?
The function of the service discovery layer of the protocol stack is centralizing services into a standard registry. For this purpose, Universal Description, Discovery, and Integration (UDDI) is used.
17. Briefly explain the four layers of the protocol stack?
- Service Transport Layer: This layer transfers messages between different applications over the network. It includes protocols such as HTTP, SMTP, FTP, and BEEP.
- XML Messaging Layer: This layer encodes messages in XML format to make them understandable to the communicating applications. It includes protocols such as XML-RPC, SOAP, etc.
- Service Description Layer: This layer describes the user interface to a web service, such as WSDL.
- Service Discovery Layer: This layer centralizes web services to a standard registry. It helps to publish their location and to discover the web services available such as UDDI.
18. What is HTTP?
- HTTP stands for hypertext transfer protocol.
- It is a widely used protocol.
- It enables the transfer of information between the client and the server.
- Mostly a web browser requests for data transfer and server responses to that request.
- It is a simple, stable, and widely distributed client-server protocol.
19. What is BEEP?
- BEEP stands for Blocks Extensible Exchange Protocol (BEEP).
- It is a new Internet Engineering Task Force (IETF) framework.
- It is used to build new protocols.
- It includes many features such as authentication, error handling, and security.
- It can be used for instant messaging, file transfer, content syndication, and network management.
20. What are the advantages of web services?
Web services have the following advantages:
- Open functionalities of applications over the network.
- Follows a standard protocol
- Reduced cost of communication
- Provides a common format for communication between applications.
- Ease of use
21. What do you mean by XML-RPC?
- It is an XML-based protocol.
- It enables remote procedure calls.
- It is used to exchange information between a client and a server computer over a network.
- The HTTP protocol is used by XML-RPC for this information exchange.
22. What is SOAP?
SOAP stands for Simple Object Access Protocol. SOAP is a web service that implements the SOAP web services specifications that are a set of rules defining how two web applications can talk to each other. These are standards set by the world wide web consortium(W3C). It is a protocol that includes a WSDL file describing the functionalities a web service has to offer. SOAP helps to communicate between different applications with the help of a specific format i.e XML.
23. What is REST?
REST stands for Representational State Transfer. It is an architectural style that helps web applications residing on different platforms to exchange information. It uses HTTP as its medium for transfer. It is also called Restful web service. It secures and uniforms the calling client. The requesting client can perform predefined operations using the Restful service. It uses methods such as GET, POST, PUT, DELETE.
24. What is WSDL?
It is a web services description language. A client requesting a web service needs to know what functions a web service has to offer or what it does. Otherwise, how a client will know which web service is suitable for its web application. But, to do so a common format i.e XML based format is needed to tell the client about the functionalities of a web service. This purpose is served by WSDL which is a file written in XML for the client to be able to know the exact location and its utilization.
25. What is UDDI?
UDDI is Universal Description, Discovery, and Integration. It means it is a universal standard for describing, publishing, and discovering the web services that are provided by a web service provider. It provides a specification that helps in hosting the information on web services. It is a collection of WSDL files, and it helps the client to locate a specific WSDL file. So, we can say it acts as a folder containing hosted WSDL files.
26. What is meant by the Interoperability of a web service?
Web services permit various applications to communicate with each other and exchange data among themselves. Other applications can also use web services. E.g., a python or nodeJs application can talk to Java web services and vice versa. Hence, we can use them to make the application platform and technology independent.
27. What is meant by the loosely coupled architecture of web services?
Web services are the services available over the web. These services, therefore, can be utilized by a client. But, a client is not directly connected to these web services. The web service interface can change over time without compromising the client’s ability to interact with the service. Tightly coupled systems are those in which the client-server is connected so that if one interface changes, the other must be updated. On the other hand, a loosely coupled architecture makes software systems more manageable and allows simpler integration between systems.
What are the advantages of SOAP web services?
- WS Security
- Language independent
- Platform independent
28. Why are web services XML-based?
XML is an extensible markup language that formats the data and other information in a detailed and structured manner. Hence, web services are XML-based. It describes their interface to the client requesting the web service. This description language is called Web Services Description Language(WSDL).
29. Explain the web service architecture?
Web service architecture includes three main components namely provider, a requestor, and a broker.
- Provider: The provider creates the web service and makes it available to client applications requesting the service.
- Requestor: A requestor is the client application that needs to access a web service.
- Broker: The broker is the application that provides access to the UDDI. The UDDI helps the client application to locate the web service.
30. What is W3C?
- W3C stands for World Wide Web Consortium.
- It is an international community that develops open standards for web services.
31. Are web services safe to use? Briefly describe the security of web services.
The security of web services can be achieved through Entrust Secure Transaction Platform. Web services need this level of security to make sure reliable transactions and secure confidential information.
32. What do you understand by foundation security services?
The foundation security services are those services that define
- Digital signatures
- Encryption processes of web services.
33. What is Entrust Identification Service?
- Entrust Identification Service is a service offered through Entrust Security Transaction Platform. This platform helps to control the identities that are trusted to perform transactions for Web services transactions.
- Identity enables high assurance consumer authentication to ensure secure and frictionless transactions with digital identity proofing, secure customer portals, document signing, and transaction verification.
34. What do you mean by Entrust Privacy Service?
Entrust Privacy Service deals with security and confidentiality. This service encrypts data to ensure that only concerned applications can access the requested data.
35. What is the full form of PKI? How does it work?
PKI is a Public-Key Infrastructure. It is used for direct encryption through the keys that it generates. It works by using two different cryptographic keys: public key and private key. It enables encryption and decryption of the data to be transferred securely.
36. Can you name some tools used to test web services?
Yes, the following are the tools to test web services:
37. What is SOA? How is it different from a web service?
SOA is a Service Oriented Architecture. SOA is used to implement other services by common communication standards. It can be implemented using various protocols such as HTTP, HTTPS, JMS, RPC, etc. On the other hand, web service itself is an implemented technology. One can implement SOA using the online services available.
38. Do you have any idea about the approaches used to develop SOAP web services?
- SOAP web service can be developed using two different types of approaches namely contract-first and contract-last.
- In the contract-first approach, as the name suggests, the contract is defined first and then the classes are derived from the contract.
- In the case of the contract-last approach, the classes are defined first and then the contract is derived from these classes.
39. Can you name some commercial implementations for web services?
- JAX-WS Reference Implementation
- JAX-RS Reference Implementation
- Apache CXF
40. What is API?
An application-programming interface (API) is a set of programming instructions and standards for accessing a Web-based software application.
41. How can one provide API to users?
API can be provided to the users with an “open table”. Open table is an XML format that points to a web service.
42. Name the methods of HTTP?
43. Can you briefly explain the methods of HTTP?
- GET requests for data or information from a specific resource.
- POST sends data or information to the server to update a resource.
- PUT sends data to a server and creates a new resource.
- HEAD is nearly just like GET, it does not have the response body.
- DELETE as the name suggests deletes the requested resource.
- OPTIONS include the communicating options available for the specific resource.
44. What are the situations when we need ASP.NET web services?
ASP.NET web services are handy to use when one needs to implement the three-tier architecture in a web service. It enables methods to use middle-tier components through the internet. The main advantage of .NET Web services is that they are capable enough to talk between firewalls since SOAP transport protocol is used.
45. What is meant by a distributed technology? Why are distributed technologies demanded?
A distributed technology is a distributed system having different machine components that can talk to each other over a network.
In distributed computing, processing and data are opened up over different computer machines. The technology that is distributed over the network is called a distributed technology. It enables segmenting of application units and transferring them to different computers on different networks.
46. What is COBRA and DCOM?
- COBRA stands for common object request broker architecture.
- DCOM stands for distributed common object model.
- Both of them are solutions for handling distributed objects.
- Enables to handle the distributed computing objects.
- COBRA provides communication between distributed objects regardless of their running platforms such as Windows or macOS.
- COBRA is interoperability between different programming languages.
- ORB(Object Request Broker) is the main component of COBRA.
- DCOM is a protocol provided by Microsoft for secure communication between two different applications running on distributed systems.
47. What are the differences between web services, CORBA, and DCOM?
- Web services transfer/receive messages to/from applications respectively.
- It is a client-server interaction through web services with HTTP protocol.
- It uses a common XML format to do so.
- CORBA and DCOM transfer/receive messages to/from application respectively with non-standard protocols.
- The non-standard protocols such as IIOP and RPC
48. Which standards are used in web services? Name them.
The following standards are used in web services:
- WSDL (used to create interface definition)
- SOAP (used to structure data)
- HTTP (communication channels)
- DISCO (used to create discovery documents)
- UDDI (used to create business registries).
49. What do you mean by DISCO?
- DISCO means discovery or the discovery of web services.
- DISCO is a collection of interrelated web services provided by the webserver.
- With DISCO, it becomes easy to discover the potentials of various available web services.
- We can interact with web services through WSDL.
- The computer system that implements web services issues a DISCO file on its server and that file contains the links of all the provided web services.
- It can be used within a local network as well.
50. What are the solutions by Microsoft for distributed applications?
- .NET Web Services
- .NET Remoting.
51. Can you differentiate between the .NET Web Services and the .NET Remoting?
- .NET Web Service uses the standard HTTP protocol
- .NET Remoting uses any protocol like TCP/HTTP/SMTP.
- .NET Remoting is faster in performance than .NET Web Service.
- .NET Web Services are hosted through IIS.
- .NET Web Services are more reliable than the .NET Remoting.
52. Can you name and explain the different kinds of implementations of web services?
- XML-RPC (Remote Procedure Call)
It is the most basic XML protocol to exchange data between a wide variety of devices on a network. It uses HTTP protocol to transfer data and communicate other information from client to server.
- UDDI is Universal Description, Discovery, and Integration.
It means it is a universal standard for describing, publishing, and discovering the web services that are provided by a web service provider. It provides a specification that helps in hosting the information on web services. It is a collection of WSDL files and it helps the client to locate a specific WSDL file. So, we can say it acts as a folder containing hosted WSDL files.
- SOAP stands for Simple Object Access Protocol.
SOAP is a web service that implements the SOAP web services specifications that are a set of rules defining how two web applications can talk to each other. These are standards set by the world wide web consortium(W3C). It is a protocol that includes a WSDL file describing the functionalities a web service has to offer. SOAP helps to communicate between different applications with the help of a specific format i.e XML.
- REST stands for Representational State Transfer.
It is an architectural style that helps web applications residing on different platforms to exchange information. It uses HTTP as its medium for transfer. It is also called Restful web service. It secures and uniforms the calling client. The requesting client can perform predefined operations using the Restful service. It uses methods such as GET, POST, PUT, DELETE.
53. How is RESTful web service different from SOAP web service?
The RESTful web services contain no contract or WSDL file as the SOAP web service.
54. What do you mean by a SOAP message? What does a SOAP message include?
A SOAP message is a document written in Extensible Markup Language(XML) to provide a common format for data transfer between applications. It includes:
55. Briefly explain the components of a SOAP message?
A SOAP message is a document written in Extensible Markup Language(XML) to provide a common format for data transfer between applications. It has the following four components:
- Envelope: It defines the start and the end of the message. It is a mandatory element.
- Header: It contains any optional attributes of the message used in processing the message, either at an intermediary point or at the ultimate end-point. It is an optional element.
- Body: It contains the main XML data comprising the message being sent. It is a mandatory element.
- Fault: It is an optional element that provides information about errors that occur while processing the message.
56. Are there any drawbacks of using GET and POST methods of HTTP to communicate with the web service?
Yes, GET and POST methods are less secure and inhibit users to pass structures and objects as arguments. These methods are not suitable for sensitive information. It has a limited length of URL that potentially creates a loss of data while transferring. POST requests do not use caching.
57. Can we access a class as a web service? If yes, how?
Yes, we can do so. It is possible if we can inherit the class properties from the System.Web.Services.WebService class and qualify the class with the WebService attribute.
58. What components need to be published during a web service deployment?
The components that need to be published during a web service deployment are
- Web Application Directory
- Webservice.asmx File
- Webservice.Disco File
- Web.Config File and
- Bin Directory.
59. Mention the steps performed by the client to access a web service?
The first step is to create a web service reference by the client requesting the web service. After this web reference, a class is generated called a proxy class. Followed by a proxy class object is created and at the end, the client can get a response i.e client can access the web service through the proxy object created.
60. What do you mean by response caching?
We can define response caching as the minimal number of requests a client makes to a web server. It reduces the level of work to be done by the web server to generate a response to the request made. Response caching is controlled by headers that specify how you would like client, proxy, and middleware to cache responses.
61. Are there any disadvantages of using response Caching? Explain.
Caching means storing a lot of information for future requirements. It speeds up the workflow. Response Caching is impractical when methods accept an extensive amount of values. Also, if the method depends on some external source of information, and that is not provided as the arguments then such methods are avoided.
62. Is there any alternate way to respond to caching?
Yes, we can use Data Caching in place of Response Caching.
63. What is meant by synchronicity?
It refers to the binding of the client to the execution of the service. In synchronous invocations, the client blocks and waits for the service to finish its operation before continuing whereas asynchronous operations allow a client to invoke a service and then execute other functions.
64. Explain JAVA web services? What are the methods to create web services?
Java web services are built web services on the JAVA platform. It is a java application that can be accessed by other programming languages like .NET or PHP for communication.
The two main java web services API: JAX-WS and JAX-RS. We can implement java web services through SOAP and RESTful. JAX-WS is implemented using SOAP web services whereas JAX-RS is implemented using RESTful web services.
To create a web service, the following two methods can be used namely
- Top-down approach
- Top-up approach
65. What is JAXP?
JAXP is a JAVA API for XML processing that makes it possible for applications to read, write, manipulate and transform XML data.
66. Can you name some Java APIs?
67. Explain JAXB binding framework?
JAXB binding framework can be explained by Java Packages offering these binding frameworks.
- xml.bind: It defines abstract classes and interfaces that are used directly with content classes.
- xml.bind.util: A package that includes utility classes that may be used by client applications to handle marshalling, unmarshalling, and validation events.
- xml.bind.helper: A helper package that gives partial implementations for some of the javax.xml.bind interfaces.
68 . What do you mean by JAXM messaging models?
There are two kinds of messaging models used for JAXM namely synchronous and asynchronous.
- Synchronous messaging model:
- It includes direct communication between the client and the server. The client waits once the request is sent.
- Asynchronous messaging model:
- It includes the message that the client directs to the messaging provider and then returns it. The messaging provider then executes the routing of the message to the end source.
69. Briefly tell about the JAXR architecture?
- JAXR architecture includes a JAXR client and a JAXR provider.
- JAXR client: It is a client program that uses the JAXR API to use a registry through a JAXR provider
- JAXR provider: It is an implementation of the JAXR API that provides access to a particular registry provider or to a class of registry providers that are built on common specifications.
70. Name the packages available in XML Digital signature API?
The packages available in XML Digital signature API are
71. What are the types of validation performed by a JAXB client?
There are two types of JAXB client validation that a JAXB can perform namely:
- Unmarshal Time Validation
- On-Demand Validation
72. How to face the event during the marshal, unmarshal and validate operations?
- Using the default event handler
- Register and Implement a custom event handler
- Use the ValidationEventCollector utility
73. How are the Network security threats handled in web services?
- Secure the transport layer
- Implement XML filtering
- Mask internal resources
- Protect against XML denial-of-service attacks
- Validate, Transform, Sign and Timestamp all messages.
74. What are the major security issues with web services?
- Network security
75. Discuss the roles of a web service?
There are three major roles:
- Service provider: It is the web service provider. The service provider implements the service and makes it available over the web.
- Service requestor: It includes a requestor that uses an existing web service by opening a network connection and sending an XML request.
- Service registry: It is a centralized directory of services. The registry provides a central place where developers can create/publish new services.
76. What is meant by Marshalling in the java framework?
Marshalling refers to the process of writing Java objects to an XML file that is the common format.
77. What is meant by Unmarshalling in the java framework?
Unmarshalling is the process of converting XML content to Java objects.
78. What is Stax?
- Stax stands for Streaming API for XML
- It is an API to read and write an XML document
- It comes from the JAVA programming language.
79. Mention what are the usual XML APIs?
The usual XML APIs includes
- DOM-based APIs: The complete document is read into memory as a tree structure for random availability by calling the application. Also known as Tree-based APIs.
- Event-based APIs: The application registers to get events as entities are encountered within the source document
80. Explain what is Push parsing and Pull parsing?
- Pull Parsing
In pull parsing, is the programming model in which a client application calls methods on an XML parsing library when it needs to communicate with an XML Infoset which means the client will only get XML data when it is asked for that.
- Push Parsing
In Push Parsing, the parser pushes parsing events or XML data to the application. In the push model, the parser got the hold over the parsing process and the parser calls the implemented handler methods.
81. What are the features of Amazon Web Services?
- Amazon Web Services is a cloud computing platform.
- It provides its clients with a wide range of cloud services.
- AWS (Amazon Web Services) is a secured cloud service platform that offers database storage, content delivery, and various other functionalities.
- To be more specific, it is a large collection of cloud-based services.
82. Can you name a few Amazon web services?
- Amazon Elastic Compute Cloud (EC2)
- AWS Lambda
- Amazon SNS
- Amazon Glacier
- Amazon CloudFront
This brings us to the end of the blog on Web Services Interview Questions and Answers. We hope that you are now better-equipped for your upcoming interview. To learn more such concepts, you can join Great Learning Academy’s Free Online Courses and power ahead your career today.0