Top 20 Web services interview questions

Web services interview questions are most asked questions if you are applying for software developer role.
In this post, we will see multiple web services questions.

1. What are web services?

Web services are ways of communication between two application over network. It allows you to expose business logic using API.
For example:
Lets say you are java developer, you can create web service and expose API over internet and any other developer (lets say .net developer ) can access it.

2. What are features of web services?

  • Interoperability
  • Reuse already developed(old) functionality into new software:
  • Loosely Coupled
  • Extensibility

3. What are different types of web services?

  • SOAP
  • Restful web services

4. What is SOAP?

SOAP stands for Simple object access protocol. It is protocol to exchange information using request and response in XML format over transport protocol such as HTTP, SMTP etc.

5. What are important components for SOAP?

  • Simple access object protocol (SOAP)
  • Web Services Description Language (WSDL)
  • Universal Description, Discovery and Integration(UDDI)

6. What is WSDL?

WSDL stands for Web Service Description Language. It is an XML file that describes the technical details of how to implement a web service, more specifically the URI, port, method names, arguments, and data types. You can understand following details using WSDL

  •     Port / Endpoint – URL of the web service
  •     Input message format
  •     Output message format
  •     Security protocol that needs to be followed
  •     Which protocol the web service uses

7. What is UDDI?

UDDI stands for Universal Description, Discovery and Integration.It is a directory service. Web service provider can register themselves with a UDDI and make themselves available through it for discovery.

8. What is JAX-WS?

JAX-WS stands for Java API for XML Web Services. JAX-WS is standard XML baed java API which is used to create SOAP web services.

9. What are some important annotations for JAX-WS?

  • @WebService
  • @WebMethod
  • @SOAPBinding

10. What do you mean by end point in terms of SOAP?

End point is nothing but URL which other application can use to access it.

for example:
end  point:http://localhost:8080/WS/HelloWorld

11. How can you access WSDL for web service?

You just need to put ?wsdl at the end of end point URL.
for example:
end  point:http://localhost:8080/WS/HelloWorld
WSDL url: http://localhost:8080/WS/HelloWorld?wsdl

12. What is wsimport?

wsimport is utility which generates java classes from WSDL. It is part of JDK 6.

13.What is sun-jaxws.xml file?

This file provides endpoint details about JAX-WS web service which is deployed on tomcat.It is available at WEB-INF directory.
For example:

14. What are Restful web services?

In the web services terms, REpresentational State Transfer (REST) is a stateless client-server architecture in which the web services are viewed as resources and can be identified by their URIs. Web services client uses that URI to access the resource.

15.What are HTTP methods that can be used with Restful web services?

Mainly used HTTP methods are GET, POST, PUT ,DELETE, HEAD and OPTIONS

16. What is JAX-RS?

Java API for RESTful Web Services (JAX-RS), is a set if APIs to develop REST service. JAX-RS is part of the Java EE6, and make developers to develop REST web application easily.

17. What are some important annotations which you use to create Restful web services?

Some of important annotations which are used for creating web services are:

@Path : This is used to set path for URI at class level or method level
@GET,@POST,@PUT,@DELETE  : There are annotations corresponds to HTTP methods
@Produces(MediaType.TEXT_XML [, more-types ]): @Produces defines which MIME type is delivered by a method
@PathParam: Used to inject values from the URL into a method parameter.
@Consumes(MediaType.TEXT_XML) : @Cosumes defines which MIME type will be consumed by the method .

18.  What are ways to test SOAP web services?

For testing SOAP :
For testing Restful web services:

  • Postman for chrome browser
  • poster for firefox

19. How to choose between REST and SOAP web services?

  • If you want to implement web services in less time, go with REST
  • If you know your client beforehand , then you can choose SOAP. If you are not aware about clients then go with REST.
  • If you want to work with different format other than XML, go with REST. SOAP only supports XML format.

20. What are differences between SOAP and REST web services.

SOAP stands for simple object access protocol
REST stands for REpresentational State Transfer
Protocol vs Architectural style
 SOAP is a standard protocol to create web services
Rest is architectural style to create web services.
Client and Server are bind with WSDL contract
There is no contract between client and Server.
Format Support
SOAP supports only XML format
REST web services supports XML, json and plain text etc.
SOAP web services are hard to maintain as if we do any changes in WSDL , we need to create client stub again
REST web services are generally easy to maintain.
Service interfaces vs URI
SOAP uses Service interfaces to expose business logic
Rest uses URI to expose business logic
SOAP has its own security : WS-security
Rest inherits its security from underlying transport layer.
SOAP requires more bandwidth and resources as it uses XML messages to exchange information
REST requires less bandwith and resources. It can use JSON also.
Learning curve
SOAP web services are hard to learn as you need to understand WSDL , client stub
REST web services are easy to understand as you need to annotate plain java class with JAX-RS annotations to use various HTTP methods.

You may also like:


  1. Florian Neiss September 12, 2016
  2. gulmohammad March 18, 2017

Add Comment