Disclosure: Hackr.io is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.
Web Services Interview Questions
Web services make use of the standardized XML messaging system, which is not only easily available over the Web, but also to private networks. Anyone interested in following a career lane in web application development must have knowledge about web services.
Best Web Services Interview Questions
Here we have collected top web services interview questions and answers that will help you prepare for your upcoming job interview. So, here we go:
Question: Please enumerate the various components of Web services.
Answer: Here are the components:
- Extensible Markup Language (XML)
- Resource Description Framework (RDF)
- Simple Object Access Protocol (SOAP)
- Universal Description, Discovery, and Integration (UDDI)
- Web Service Description Language (WSDL)
Question: Could you explain the term Interoperability in the context of Web services?
Answer: Generally, the term interoperability refers to the ability of two or more products or systems to work in tandem without any special requirements. In the context of web services, the term interoperability means communication and sharing data and services amongst applications.
Question: What do you understand by the various layers of the web service protocol stack?
Answer: There are a total of 4 layers in the web service protocol stack and each of them is responsible for certain tasks:
- Service Transport – This is the first layer in the web service protocol stack. It helps in transporting XML messages among various client applications. The following protocols are usually used by the layer:
- Block Extensible Exchange Protocol (BEEP)
- File Transfer Protocol (FTP)
- Hypertext Transport Protocol (HTTP)
- Simple Mail Transport Protocol (SMTP)
- XML Messaging – Based on the XML model, this is the layer where messages are encoded in the common XML format. The layer consists of:
- Simple Object Access Protocol (SOAP)
- Service Description – Consists of available functions, location, and data types of XML messaging. It describes the public interface to a specific web service and includes the WSDL.
- Service Discovery – Provides the way for publishing as well as finding web services over the Web. It includes UDDI.
Question: Do you know what the XML-RPC protocol is? Explain its features.
Answer: The XML-RPC is a remote procedure call responsible for calling a function or procedure available on a remote computer. In other words, the XML-RPC is a simple protocol capable of performing RPCs by means of XML messaging.
In addition to establishing connections among a variety of computers, the XML-RPC serves as an excellent tool for connecting distinct environments. Following are the various features of the XML-RPC protocol:
- Allows establishing communication amongst diverse applications
- Has small XML vocabulary for describing the nature of request and response
- HTTP Response has XML Response embedded in it
- Remote procedure calls are performed using simplistic XML
- Uses HTTP protocol in order to pass information between client and server computers
- XML encoded requests are sent through HTTP POST
Question: Can you explain the term UDDI and its features? What language does it use?
Answer: UDDI or Universal Description, Discovery, and Integration is an XML-based standard in the service discovery layer of the web service protocol stack. It uses Web Service Description Language (WSDL).
As the UDDI acts like a directory, it is used for finding and publishing web services over the web. Major features of UDDI are:
- Acts as a database containing all WSDL files
- Helps businesses discover and interact with each other over the Internet
- Open framework
- Uses COBRA, Java RMI, and SOAP protocols for establishing communication
Question: What do you mean by RESTful Web Services? What are the various advantages of the same?
Answer: REST is a contraction for Representational State Transfer. It is the stateless client-server architectural style for developing applications accessible over the Web. Web services using HTTP methods for implementing the REST architecture are called RESTful Web Services.
Data and functionality serve as resources accessed by the URI in the REST architectural style. RESTful Web Services have desirable properties like Modifiability, Performance, and Scalability. Following are the important advantages of using RESTful Web Services:
- Can be written in any programming language
- Capable of being easily tested over web browsers
- Fast and lightweight protocol, consumes less bandwidth and resources
- Has loosely coupled implementation
- Platform independent
- Provides support for an array of data formats, such as JSON and plain text, and technologies
Question: Please draw a comparison between SOAP and REST.
- Coupling – Web services and clients are tightly coupled in SOAP. Furthermore, it defines some standards meant to be followed strictly. Contrarily, REST doesn’t follow too many standards in addition to offering loose coupling
- Data Format and Preference – REST is preferred here and allows several data formats, like HTML and JSON. SOAP supports only the XML data format
- Intent – While SOAP serves as a standard protocol for creating web services, REST is an architectural style of building web services
- Java API – Java API for RESTful Web Services is JAX-RS while JAX-WS is the Java API for SOAP Web Services
- Requirement – REST demands less bandwidth and resources and uses URI for exposing business logic. SOAP, on the other end, requires more bandwidth and resources and uses service interfaces for exposing business logic
- Security – REST neither have a defined binding contract nor its own security methods. SOAP, however, uses WSDL contract for binding client programs and web services and has its own defined security methods.
- Testing – SOAP web services are tested using SOAPUI. On the other hand, web browsers and extensions, such as Chrome postman, are available for testing RESTful web services
Question: Could you name the core components of the HTTP request and HTTP response.
Answer: Core components of HTTP requests are:
- HTTP Version – Indicates version
- Request Body – Represents message content
- Request Header – Contains metadata, such as cache settings and client type, for the HTTP request message
- URI – Identifies the resource on the server
- Verb – Indicates HTTP methods such as GET, POST, and PUT
HTTP response has the following core components:
- HTTP Version – Indicates the present version of HTTP
- Response Body – Represents the response message content
- Response Header – Consists of metadata, like content length and server length, for the HTTP response message
- Status/Response Code – Indicates the server status for the requested resource
Question: What do you understand by the term statelessness in respect to RESTful Web Services? What are its advantages and disadvantages?
Answer: Following the REST architecture, a RESTful web service isn’t allowed to keep a client state on the server. This condition is known as statelessness. In such a situation, the client passes its context to the server. The server then stores the context for processing further client requests.
- Independent treatment of every method
- Simplified application design
- Works with the HTTP protocol
- Demands providing extra information about each request for interpreting the client state every time a client interaction takes place
Question: When designing a secure RESTful web service, what points should be followed?
- Execute DELETE, GET, POST, PUT, etc. methods with proper restrictions
- Invoke the HTTP generic message whenever and wherever required
- Pass sensitive data, like username and session token password, via the POST method. Never use it through the URL
- Perform user session-based authentication each time a request is made
- Validate all inputs on the server from SQL injection attacks
Question: List the various advantages and disadvantages of SOAP.
- Allows communication between various applications
- Decouples the communication and encoding protocol from the runtime environment
- Defines as well as uses its own security dubbed WS security
- Eliminates firewall issues in addition to being vendor-neutral
- Permits circulation of messages in a decentralized and distributed environment
- Platform as well as programming language independent
- Uses HTTP protocol and XML for sending and receiving messages
- Absence of security features
- Clients and web services are tightly coupled
- Defines standard meant to be followed strictly
- Inability to be tested on web browsers
- Lightweight formats, other than XML, aren’t supported
- Slower performance
Question: What are the various elements of a SOAP message?
- Body – Contains the call and response messages. Also defined as a child element of the envelope that contains entire application derived XML data, which has been exchanged as a part of the SOAP message.
- Envelope – The mandatory root element. Translates the XML document and determines the start and end of the SOAP message.
- Fault Element – Handles the errors occurring during the processing of the messages. Appears as a child element of the body if the error is present.
- Header – Contains optional message header attributes containing specific application information. Intended to add new features and functionalities, this element can occur several times in a single SOAP message.
Question: Please explain what you understand by SOA.
Answer: SOA stands for Service Oriented Architecture. It is defined as an architectural pattern consisting of services. In SOA, application components provide services to other components via the communication protocol.
The communication might involve data exchange or some kind of coordination activity amongst services. Important key principles regarding SOA are:
- In addition to being standardized, the service contract must contain the entire description of the services
- In order to work with different application types, services should be reusable
- Loose coupling defines the less dependency between the web services and the client
- Must follow the Service Abstraction rule, according to which, the service shouldn’t expose the way functionality is executed to the client application
- Services should be stateless and must have the feature of discoverability
Question: What do you understand by WSDL?
Answer: WSDL or Web Service Description Language is a simple XML document present in the Service Description layer of the web service protocol stack. It describes the technical details or locates the UI to the web service. It contains the following important information:
- Header information
- Method name
- Method parameters
- Port types
- Service endpoint
Question: Enumerate the various primary security issues of Web services.
Answer: Here you will get the primary security issues:
- Authentication – Performed to verify the identity of a user and checking whether the user has the right to access the web service or not. It is also done with the intent of tracking user activity. Following options can be considered for authenticating:
- Application-level authentication
- Client certificates
- HTTP digest and HTTP basic authentication
- Confidentiality – Any individual web service might have several applications. Their service path typically contains a potential weak link at its nodes. Hence, whenever messages or XML requests are sent by the client together with the service path to the server, the same must be encrypted.
- Network Security – Very important security issue necessitating tools for filtering web service traffic
Note: - In order to ensure reliable transactions as well as securing confidential information, web services demand a high level of security. It is achieved via the Entrust Secure Transaction Platform.
Question: What are the various elements of WSDL documents?
- Binding – Defines as well as determines the protocol as well as the data format for each port type
- Message – Defines the data elements for each individual operation. It could be the entire document or an argument yet to be mapped
- Operations – Defines the operations to be performed for processing a message
- Port Type – Defines the collection of operations which can be performed for binding
- Types – Defines the message data types, in the form of XML schema, used by the web services
Question: Is it possible to bind SOAP and WSDL?
Answer: Binding SOAP and WSDL is possible. It can be done using the following two attributes:
- Name – Defines the name of the binding
- Type – Defines the port for the binding
Question: Please explain the two attributes of the <Port> element in WSDL.
Answer: Each <Port> element is related to a distinct binding by defining an individual endpoint. A <Port> element has the following two attributes:
- Binding – refers to the process of binding that has to be performed as per the linking rules defined by WSDL
- Name – Provides the unique name within the WSDL document
Question: What points should you consider while binding in WSDL?
Answer: While binding in WSDL, a port must not:
- Specify any kind of binding information other than the address information
- Specify more than one address
Question: Could you explain the various advantages of using Web services?
Answer: There are several advantages of using web services, the most notable of which are described as follows:
- Assists in exposing the extant functionalities over the network so that other applications can use them
- Easy to deploy, integrate and reuse
- Facilitates simple integration thanks to the loose coupling
- Low communication cost thanks to the use of SOAP over HTTP protocol
- Provides some kind of required functionality to client applications
- Supports interoperability, allowing applications to effortlessly communicate and share data as well as services with each other
- Uses the standardized web service protocol stack for communication
Question: What do you understand by Web Service?
Answer: Web service is a software that is available in the virtual world and supports access to the internet. It is characterized by an XML messaging system that allows users to interact through the web. Web service is an easy to understand interface that can be used by the user.
Question: Give a real-life example of web service?
Answer: The real-life example of web service is the IBM web service browser. This web service can be bought from IBM Alphaworks site. The purpose of this browser is to show various demos linked with web services. These web services can be used along with the help of SOAP, UDDI, and WSDL, which helps in providing plug and play interface. That can be used for web service, including weather forecast service, traffic reporting service, stock-quote service, and various others.
Question: How does the web service work?
Answer: Web service helps in communication among various other applications by applying open standards, including SOAP, WSDL, XML, and HTML. For instance, we can create a Java-based web service on Solaris, which is accessible from the Visual Basic programs that run on the computer window. Another example would be of using C# to develop new web services on windows by using a web application that is based on JSP or Java Server Pages and runs on Linux.
Question: What are the advantages of using web services?
Answer: There are several advantages to using web services. These include the following:
- It helps in achieving the cheaper cost of communication. The use of existing internet can be made for using web services.
- It helps in applying standard protocol for every application program. It could help all the client applications to write in a different language, which is understood by them. This way, facilitation is provided to the users using a standard protocol that helps in attaining a kind of cross-platform.
- It helps in achieving modularity. That is the web services can help in the creation of service for specific tasks, including tax calculations and various others.
- It helps in applying reusability by exposing the web services so that various other applications can be used.
- It helps in offering interoperability through which an application can be communicated with other application which may be developed in any different language.
Question: What is a web service protocol stack?
Answer: The web service protocol stack consists of various protocols or procedures used for exploring and executing different kinds of web services. It consists of four layers, including the following.
- XML Messaging.
- Service Discovery.
- Service Transport.
- Service Description.
Question: What is XML-RPC in web service?
Answer: XML-RPC is a protocol that supports the XML messaging service for making remote procedure calls.
Question: What is SOAP in web service?
Answer: SOAP is an XML based protocol that helps in transferring data between different computer systems.
Question: What is the full form of WSDL? What is the function of WSDL in web service?
Answer: WSDL stands for Web Services Description Language. Its function is to describe the user interface to a web service. This way, it acts as a service description layer in the web service protocol stack.
Question: Do we need security in web services? Explain?
Answer: Yes, we do need security in the web services so that confidential information and transactions can be made reliable. The security in web services is attained through SSL or Service Socket Layer, which helps in creating an Entrust Secure Transaction Platform.
Question: How did the concept of security services generated?
Answer: The concept of security services was generated before the rising use of the virtual world, and an increase in several frauds, hackings, and virus attacks that were affecting the process of information exchange and making data becomes vulnerable. Thus the security services are developed and upgraded at regular intervals so that the web services could be secured from any kind of activities that impact the interest and cause harm to the users. The various security services include the deployment of the basics of integration, authentication, encryption process, digital signatures, and authorization.
Question: What is the full form of EIS and EPS? What is the difference between the two?
Answer: EIS stands for Entrust Identification Service while EPS stands for Entrust Privacy Service. The Entrust Identification Services is generated from the Entrust Security Platform, which hallows the corporates to control the identities which are trusted to perform various transactions for the Web Services transaction. On the other hand, the Entrust Privacy Service deals with security and confidentiality by encrypting data to ensure that only the concerned parties and authorized personnel can access the data.
Question: Which are the browsers that allow access to Web Service?
Answer: The various browsers that allow access to Web Services include the following:
- Internet Explorer
- Mozilla Firefox
- Google Chrome and various others
Question: Define Distributed Technologies?
Answer: Distributed Technologies allow the segmentation of the application in various units and transfers them to different computer systems and networks. The increase in the number of distributed applications has given rise to distributed technologies.
Question: What are the standards in Web services?
Answer: There are several standards in Web Services. These include the following:
- WSDL: used to create an interface definition.
- HTTP: used in communication channels.
- UDDI: used for creating business registries.
- SOAP: used for structuring data.
Question: What is DISCO in web services?
Answer: DISCO is referred to as discovery in web services. It helps in grouping the list of different interrelated web services. The DISCO file is issued on the server by the company that provides web services so that the links of all the web services can be made available and used within the local network.
Question: Can we test ASP.Net service?
Answer: Yes, we can test ASP.NET services regularly. It can be done by making a call for the URL of .asmx file is made in the browser, which shows complete information regarding web services on the page.
Question: Is there any Microsoft solution for distributed applications?
Answer: Yes, there are two Microsoft solutions for distributed applications. These are as follows:
- .NET web services.
- .NET Remoting.
Question: What is the pre-requisite for deploying Web Service?
Answer: The pre-requisite for deploying Web Service includes the following.
- Web Application Directory.
- Bin Directory.
- Web.Config File.
- Disco File.
- Webservice.asmx File.
Question: How can we implement Web services in .NET?
Answer: We can implement Web Services in .NET by applying HTTP handlers, which are used to interrupt requests to the .asmx files.
Question: Can we access the web service class method using the Internet?
Answer: Yes, we can access the web service class method using the internet by qualifying a method with the WebMethod attribute.
Question: What are the types of Web services?
Answer: There are two types of web services, which include the following.
- SOAP-based web service: It consists of a contract or WSDL file.
- RESTful web service: It consists of no contract or WSDL file.
Question: What are JAVA Web Services?
Answer: JAVA Web Services are developed to create and execute basic web services on the JAVA platform.
- What are the different methods to develop JAVA Web Services?
Answer: There are two methods to develop JAVA Web Services. These include the following:
- Top-Down Approach.
- Top-Up Approach.
Question: What is JAXP?
Answer: JAXP is a JAVA API for XML processing. It helps the JAVA application in writing, reading, transforming, and manipulating the XML data. It performs various functions such as JAX-RPC, JAXB, JAXM, JAXR, and more.
Question: What are the different JAVA packages in the JAXB binding framework?
Answer: There are three different JAVA packages in the JAXB binding framework, which include the following:
- xml.bind: It helps in defining the abstract classes and interfaces which are directly connected with the content classes.
- xml.bind.util: It consists of utility classes that can be availed by client applications with the purpose to manage marshaling, validation, and unmarshalling events.
- xml.bind.helper: It gives partial implementation for javax.xml.bind interfaces.
These API cannot be directly used by the applications which are already executing JAXB architecture.
That completes the list of the top Web Services interview questions. Which ones did you know the answers to already? Which ones surprised you?
Here is a great course that will help you prepare comprehensively for any upcoming web services interviews: Spring & Spring Boot Interview Guide.
We recommend you one of the best programming interview books which will help you prepare for general programming interviews. Cracking the Coding Interview: 189 Programming Questions and Solutions.
Let us know via the dedicated comments window below. Also, you can ask your web services queries via the same.
People are also reading: