In this post, we will see multiple web services interview questions.
1. What are web services?
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?
- Reuse already developed(old) functionality into new software:
- Loosely Coupled
3. What are different types of web services?
- 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?
8. What is JAX-WS?
JAX-WS stands for Java API for XML Web Services. JAX-WS is standard XML based Java API which is used to create SOAP web services.
9. What are some important annotations for JAX-WS?
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.
11. How can you access WSDL for web service?
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.
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
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 create web service which supports REST architecture. JAX-RS is part of the Java EE6, and help developers to create REST web application easily.
17. What are some important annotations which you use to create Restful web services?
@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?
You can refer to difference between SOAP and REST web services for more details.
That’s all about Web services interview questions.
You may also like:
- restful web services interview questions
- Data structure and algorithm Interview Questions
- Spring interview questions
- Hibernate interview questions
- Core java interview questions
- Java Collections interview questions
- Java String interview questions
- OOPs interview questions in java
- Java Multithreading interview questions
- Exceptional handling interview questions in java
- Java Serialization interview questions in java