Q1 What Are Web Services ?: Answers - HTML
Q1 What Are Web Services ?: Answers - HTML
com/2015/07/web-services-interview-questions-and-
answers.html
Web services are client and server applications that communicate over the World
Wide Web’s (WWW) HyperText Transfer Protocol (HTTP). Web services provide a
standard means of inter operating between software applications running on a
variety of platforms and frameworks.
1. Interoperability
2. Extensibility
3. Machine processable descriptions.
for example in simple words , when we call somebody so the person dialing and
calling is the client application , while person receiving the call is server application
and "hello" word is the protocol as similar to HTTP request .
Web Services is a realization of SOA concept, that leverages XML, JSON, etc. and
common Internet protocols such as HTTP(S), SMTP, etc.
SOA is a system-level architectural style that tries to expose business. WOA is an
interface-level architectural style that focuses on the means by which these service
capabilities are exposed to consumers.
Q3 What is SOAP?
SOAP (Simple Object Access Protocol) is a transport protocol for sending and
receiving requests and responses on XML format, which can be used on top of
transport protocols such as HTTP, SMTP, UDP, etc.
Q4 What is REST?
Below are the main differences between REST and SOAP web service
REST supports different formats like text, JSON and XML; SOAP only
supports XML;
REST works only over HTTP(S) on a transport layer; SOAP can be used
different protocols on a transport layer;
REST works with resources, each unique URL is some representation
of a resource; SOAP works with operations, which implement some business
logic through different interfaces;
SOAP based reads can’t be cached, for SOAP need to provide caching;
REST based reads can be cached;
SOAP supports SSL security and WS-security(Web Service-security);
REST only supports SSL security;
SOAP supports ACID (Atomicity, Consistency, Isolation, Durability);
REST supports transactions, but it is neither ACID compliant nor can provide
two phase commit.
Q6 How to decide which one of web service to use REST or SOAP?
“SOAP”
Q7 What is WSDL?
WSDL (Web Services Description Language) is an XML format for describing web
services and how to access them.
Q8 What is JAX-WS?
JAX-WS (Java API for XML Web Services) is a set of APIs for creating web services in
XML format.
Q9 What is JAXB?
JAXB (Java Architecture for XML Binding) is a Java standard that defines how Java
objects are converted from and to XML. It makes reading and writing of XML via Java
relatively easy.
--MIME_boundary
Content-Type: image/tiff
Content-Transfer-Encoding: binary
Content-ID: <[email protected]>
SOAP envelop element is the root element of a SOAP message which defines the
XML document as a SOAP message.
An example:
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
...
Message information
...
</soap:Envelope>
SOAP encoding is a method for structuring the request which is suggested within the
SOAP specification, known as the SOAP serialization.
The wsgen tool is used to parse an existing web service implementation class and
generates required files (JAX-WS portable artifacts) for web service deployment:
http://docs.oracle.com/javase/6/docs/technotes/tools/share/wsgen.html
Q21 What is the difference between SOAP and other remote access techniques?
“REST”
GET;
POST;
PUT;
DELETE;
OPTIONS;
HEAD.
Q24 Whether can use GET request instead of POST to create a resource?
Need to use PUT when can update a resource completely through a specific
resource. For example, if know that an article resides at
http://javahungry.blogspot.com/article/123, can PUT a new resource representation
of this article through a PUT on this URL. If do not know the actual resource location
for instance, when add a new article, can use POST.
PUT is idempotent, while POST is not. It means if use PUT an object twice, it has no
effect.
Restlet is a lightweight, comprehensive, open source RESTful web API framework for
the Java platform.
It has advantages such as
websocket and server-sent events support;
HTTP/2 support;
transparent HTTP PATCH support;
client cache service;
fluent APIs.
http://restlet.com/
Jersey is open source framework for developing RESTful Web Services in Java that
provides support for JAX-RS APIs and serves as a JAX-RS (JSR 311 & JSR 339)
Reference Implementation. It has advantages such as
contains support for Web Application Description Language (WADL);
contains Jersey Test Framework which lets run and test Jersey REST
services inside JUnit;
supports for the REST MVC pattern, which would allow to return a
View from Jersey services rather than just data.
https://jersey.java.net/
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
@Path("/persons")
public class PersonRestService {
@GET
public Response getPerson() {
@GET
@Path("/vip")
public Response getPersonVIP() {
@PathParam annotation injects the value of URI parameter that defined in @Path
expression.
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
@Path("/persons")
public class PersonRestService {
@GET
@Path("{id}")
public Response getPersonById(@PathParam("id") String id) {
import java.util.List;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
@Path("/persons")
public class PersonService {
@GET
@Path("/query")
public Response getPersons(
@QueryParam("from") int from,
@QueryParam("to") int to,
@QueryParam("orderBy") List<String> orderBy) {
return Response
.status(200)
.entity("getPersons is called, from : " + from + ", to : " + to
+ ", orderBy" + orderBy.toString()).build();
}
}
import javax.ws.rs.GET;
import javax.ws.rs.MatrixParam;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
@Path("/books")
public class BookService {
@GET
@Path("{year}")
public Response getBooks(@PathParam("year") String year,
@MatrixParam("author") String author,
@MatrixParam("country") String country) {
return Response
.status(200)
.entity("getBooks is called, year : " + year
+ ", author : " + author + ", country : " + country)
.build();
}
}
On calling URI: “/books/2015” result: getBooks is called, year : 2015, author : null,
country : null
On calling URI: “/books/2015;author= doyle;country=scotland” result: getBooks is
called, year : 2015, author : doyle, country : scotland
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
@Path("/persons")
public class PersonService {
@POST
@Path("/add")
public Response addPerson(
@FormParam("name") String name,
@FormParam("age") int age) {
return Response.status(200)
.entity("addPerson is called, name : " + name + ", age : " + age)
.build();
}
}
HTML form:
<html>
<body>
<form action="/persons/add" method="post">
<p>
Name : <input type="text" name="name" />
</p>
<p>
Age : <input type="text" name="age" />
</p>
<input type="submit" value="Add Person" />
</form>
</body>
</html>
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.HeaderParam;
import javax.ws.rs.core.Response;
@Path("/persons")
public class PersonService {
@GET
@Path("/get")
public Response getPerson(
@HeaderParam("person-agent") String personAgent) {
return Response.status(200)
.entity("getPerson is called, personAgent : " + personAgent)
.build();
}
}
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
@Path("/persons")
public class PersonService {
@GET
@Path("/get")
public Response getPerson(@Context HttpHeaders headers) {
return Response.status(200)
.entity("getPerson is called, personAgent : " + personAgent)
.build();
}
}
import java.io.File;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
@Path("/image")
public class ImageService {
@GET
@Path("/get")
@Produces("image/png")
public Response getFile() {
http://javarevisited.blogspot.in/2012/01/rest-web-services-framework-
interview.html
REST web services has quickly becoming defacto web services in web world and has
almost replaced SOAP based web services which rules the world before. with
growing use of REST in web technology space REST is also becoming increasingly
important on J2EE and other web development interviews and if you say you know
web-service then be prepare for some REST concept related questions. In this article
I have put together some of the basic and some advanced REST web service
questions together which will be useful to revise the concept before appearing for
any REST web service interviews:
Web services written by apply REST Architectural concept are called RESTful web
services which focus on System resources and how state of Resource should be
transferred over http protocol to a different clients written in different languages. In
RESTful web services http methods like GET, PUT, POST and DELETE can can be used
to perform CRUD operations.
2) What is differences between RESTful web services and SOAP web services ?
Though both RESTful web series and SOAP web service can operate cross platform
they are architecturally different to each other, here is some of differences between
REST and SOAP:
7) What is RESTEasy ?
RESTEasy is another REST framework introduced in JBoss Application Server. This
was rather easy REST interview questions. you can answer in detail only if you have
used this or working in JBoss.
8) What are the tools used for creating RESTFull web services ?
You can use AJAX(Asynchronous JavaScript with XAML) and Direct Web Removing to
consume web serives in web application. Both Eclipse and NetBeans also supported
development of RESTFul services.
12) What happens if RestFull resources are accessed by multiple clients ? do you
need to make it thread-safe?
Since a new Resource instance is created for every incoming Request there is no
need to make it thread-safe or add synchronization. multiple client can safely access
RestFull resources concurrently.
Read more: http://javarevisited.blogspot.com/2012/01/rest-web-services-
framework-interview.html#ixzz47ePbCzjQ
http://www.java-success.com/java-web-services-interview-questions-and-answers/
As an enterprise Java developer, you will be spending more time integrating systems
via web services & messaging. Java Web Services interview questions are very
popular.
Q1. What are the different styles of Web Services used for application integration?
and What are the differences between both approaches?
A1. SOAP WS and RESTful Web Service. Web services are very popular and widely
used to integrate similar (i.e. Java applications) and disparate systems (i.e. legacy
applications and applications written in .Net etc) as they are language neutral.
SOAP Layers
SOAP uses its own protocol and focuses on exposing pieces of application REST is about exposing a
logic (not data) as services. SOAP exposes operations. SOAP is focused on (Create, Read, Update, an
accessing named operations, which implement some business logic through accessing named resourc
different interfaces.
SOAP only permits XML data formats. REST permits many differ
HTML, atom, RSS, etc. JSO
data and parses much fas
REST
SOAP based reads cannot be cached. The application that uses SOAP needs REST based reads can be
to provide cacheing.
Supports both SSL security and WS-security, which adds some enterprise Supports only point-to-p
security features. Supports identity through intermediaries, not just point to
point SSL. — The basic mechanism b
requests based on a key r
— WS-Security maintains its encryption right up to the point where the received at the destinatio
request is being processed. This means the request is
— WS-Security allows you to secure parts (e.g. only credit card details) of client and the server. Onc
the message that needs to be secured. Given that encryption/decryption is certificate), it is decrypte
not a cheap operation, this can be a performance boost for larger messages. — The SSL encrypts the w
— It is also possible with WS-Security to secure different parts of the not.
message using different keys or encryption algorithms. This allows separate
parts of the message to be read by different people without exposing other,
unneeded information.
— SSL security can only be used with HTTP. WS-Security can be used with
other protocols like UDP, SMTP, etc.
Has comprehensive support for both ACID based transaction management REST supports transaction
for short-lived transactions and compensation based transaction provide two phase comm
management for long-running transactions. It also supports two-phase is limited by its HTTP prot
commit across distributed resources.
SOAP has success or retry logic built in and provides end-to-end reliability REST does not have a stan
even through SOAP intermediaries. invoking the service to de
Which one to favor? In general, a REST based web service is preferred due to its
simplicity, performance, scalability, and support for multiple data formats. SOAP is
favored where service requires comprehensive support for security and
transactional reliability.
SOA done right is more about RESTFul + JSON, favoring lighter weight approaches to
moving messages around than the heavyweight ESBs using WSDL+XML that gave
SOA a bad name.
Q2. Differentiate between SOA (Service Oriented Architecture) versus WOA (Web
Oriented Architecture)?
A2. WOA extends SOA to be a light-weight architecture using technologies such as
REST and POX (Plain Old XML). POX compliments REST. JSON is a variant for data
returned by REST Web Services. It consumes less bandwidth and is easily handled by
web developers mastering the Javascript language
ls | ws -c
1
2 ls | ws -c
3
/api/v1/user/67
1
2 /api/v1/user/67
3
/api/v2/user/67
1
2 /api/v2/user/67
3
Q12. What are the different types of RESTful API changes requiring newer
versioning?
A12. There is no single standard approach, but here are some guidelines:
1) Simple format or cosmetic changes: Changing the output format from XML in v1
to JSON in v2. This requires JAXB annotation changes.
2) Modest schema changes. Make the required logic changes without having to
create any new packages.
3) Major schema changes. May require a parallel set of packages and artifacts like
controllers, services, entities, and possibly database tables.
Q. What are the high level steps in developing a RESTful web service in Java?
A. You can see the complete tutorial in the tutorials section. This post is to quickly
explain the major steps at the job interview. Knowing all the basics is of no use if you
can’t write a web service.
Step 1: Create a Maven project structure:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mytutorial</groupId>
<artifactId>simpleRestWeb</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>simpleRestWeb Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<resteasy.version>2.3.6.Final</resteasy.version>
<javax-servlet.version>3.0.1</javax-servlet.version>
<spring.version>3.1.0.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- JAX-RS RESTEasy implementation-->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
<!-- <scope>provided</scope> -->
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<!-- <scope>provided</scope> -->
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
<!-- <scope>provided</scope> -->
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-spring</artifactId>
<scope>runtime</scope>
<version>${resteasy.version}</version>
</dependency>
<!-- Servelet API -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
<version>${javax-servlet.version}</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>compile</scope>
<version>${spring.version}</version>
</dependency>
</dependencies>
<build>
<finalName>simpleRestWeb</finalName>
</build>
</project>
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLS
2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_
3 <modelVersion>4.0.0</modelVersion>
4 <groupId>com.mytutorial</groupId>
5 <artifactId>simpleRestWeb</artifactId>
6 <packaging>war</packaging>
7 <version>1.0-SNAPSHOT</version>
8 <name>simpleRestWeb Maven Webapp</name>
9 <url>http://maven.apache.org</url>
10
11 <properties>
12 <resteasy.version>2.3.6.Final</resteasy.version>
13 <javax-servlet.version>3.0.1</javax-servlet.version>
14 <spring.version>3.1.0.RELEASE</spring.version>
15 </properties>
16
17 <dependencies>
18 <dependency>
19 <groupId>junit</groupId>
20 <artifactId>junit</artifactId>
21 <version>3.8.1</version>
22 <scope>test</scope>
23 </dependency>
24
25 <!-- JAX-RS RESTEasy implementation-->
26 <dependency>
27 <groupId>org.jboss.resteasy</groupId>
28 <artifactId>jaxrs-api</artifactId>
29 <!-- <scope>provided</scope> -->
30 <version>${resteasy.version}</version>
31 </dependency>
32 <dependency>
33 <groupId>org.jboss.resteasy</groupId>
34 <artifactId>resteasy-jaxrs</artifactId>
35 <!-- <scope>provided</scope> -->
36 <version>${resteasy.version}</version>
37 </dependency>
38 <dependency>
39 <groupId>org.jboss.resteasy</groupId>
40 <artifactId>resteasy-jaxb-provider</artifactId>
<!-- <scope>provided</scope> -->
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-spring</artifactId>
<scope>runtime</scope>
<version>${resteasy.version}</version>
</dependency>
package com.mytutorial;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@Path("/myapp")
public interface SimpleRestWeb {
@GET
@Path("/name/{name}")
public String sayHello(@PathParam("name") String name);
}
1 package com.mytutorial;
2
3 import javax.ws.rs.GET;
4 import javax.ws.rs.Path;
5 import javax.ws.rs.PathParam;
6
7 @Path("/myapp")
8 public interface SimpleRestWeb {
9
10 @GET
11 @Path("/name/{name}")
12 public String sayHello(@PathParam("name") String name);
13 }
<jboss-web>
<context-root>tutorial</context-root>
</jboss-web>
1 <jboss-web>
2 <context-root>tutorial</context-root>
3 </jboss-web>
4
Like
0
in
Share
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mytutorial</groupId>
<artifactId>simpleSoapWeb</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>simpleSoapWeb Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<cxf.version>2.7.9</cxf.version>
<javax-servlet.version>3.0.1</javax-servlet.version>
<spring.version>3.1.0.RELEASE</spring.version>
</properties>
<dependencies>
<!-- JAX-WS -->
<!-- apache cxf -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- Servelet API -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
<version>${javax-servlet.version}</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>compile</scope>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.0</version>
</dependency>
</dependencies>
<build>
<finalName>simpleSoapWeb</finalName>
</build>
</project>
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLS
2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_
3 <modelVersion>4.0.0</modelVersion>
4 <groupId>com.mytutorial</groupId>
5 <artifactId>simpleSoapWeb</artifactId>
6 <packaging>war</packaging>
7 <version>1.0-SNAPSHOT</version>
8 <name>simpleSoapWeb Maven Webapp</name>
9 <url>http://maven.apache.org</url>
10 <properties>
11 <cxf.version>2.7.9</cxf.version>
12 <javax-servlet.version>3.0.1</javax-servlet.version>
13 <spring.version>3.1.0.RELEASE</spring.version>
14 </properties>
15
16 <dependencies>
17 <!-- JAX-WS -->
18 <!-- apache cxf -->
19 <dependency>
20 <groupId>org.apache.cxf</groupId>
21 <artifactId>cxf-rt-frontend-jaxws</artifactId>
22 <version>${cxf.version}</version>
23 </dependency>
24
25 <dependency>
26 <groupId>org.apache.cxf</groupId>
27 <artifactId>cxf-rt-transports-http</artifactId>
28 <version>${cxf.version}</version>
29 </dependency>
30
31 <!-- Servelet API -->
32 <dependency>
33 <groupId>javax.servlet</groupId>
34 <artifactId>javax.servlet-api</artifactId>
35 <scope>provided</scope>
36 <version>${javax-servlet.version}</version>
37 </dependency>
38
39 <!-- Spring -->
40 <dependency>
41 <groupId>org.springframework</groupId>
42 <artifactId>spring-web</artifactId>
43 <scope>compile</scope>
44 <version>${spring.version}</version>
45 </dependency>
46
47 <dependency>
48 <groupId>org.slf4j</groupId>
49 <artifactId>slf4j-api</artifactId>
50 <version>1.7.0</version>
51 </dependency>
52 </dependencies>
53 <build>
54 <finalName>simpleSoapWeb</finalName>
55 </build>
56 </project>
57
package com.mytutorial;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface SimpleSoapWeb {
@WebMethod
public String sayHello(String name);
}
1 package com.mytutorial;
2
3 import javax.jws.WebMethod;
4 import javax.jws.WebService;
5
6 @WebService
7 public interface SimpleSoapWeb {
8
9 @WebMethod
10 public String sayHello(String name);
11 }
<jboss-web>
<context-root>tutorial</context-root>
</jboss-web>
1 <jboss-web>
2 <context-root>tutorial</context-root>
3 </jboss-web>
4
x
m
l
n
s
:
w
s
d
l
=
"
h
t
t
p
:
/
/
s
c
h
e
m
a
s
.
x
m
l
s
o
a
p
.
o
r
g
/
w
s
d
l
/
"
x
m
l
n
s
:
t
n
s
=
"
h
t
t
p
:
/
/
m
y
t
u
t
o
r
i
a
l
.
c
o
m
/
"
x
m
l
n
s
:
s
o
a
p
=
"
h
t
t
p
:
/
/
s
c
h
e
m
a
s
.
x
m
l
s
o
a
p
.
o
r
g
/
w
s
d
l
/
s
o
a
p
/
"
x
m
l
n
s
:
n
s
1
=
"
h
t
t
p
:
/
/
s
c
h
e
m
a
s
.
x
m
l
s
o
a
p
.
o
r
g
/
s
o
a
p
/
h
t
t
p
"
n
a
m
e
=
"
s
i
m
p
l
e
S
o
a
p
S
e
r
v
i
c
e
"
t
a
r
g
e
t
N
a
m
e
s
p
a
c
e
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g
=
"
t
n
s
:
s
i
m
p
l
e
S
o
a
p
S
e
r
v
i
c
e
S
o
a
p
B
i
n
d
i
n
g
"
n
a
m
e
=
"
S
i
m
p
l
e
S
o
a
p
W
e
b
I
m
p
l
P
o
r
t
"
>
<
s
o
a
p
:
a
d
d
r
e
s
s
l
o
c
a
t
i
o
n
=
"
h
t
t
p
:
/
/
l
o
c
a
l
h
o
s
t
:
8
1
8
0
/
t
u
t
o
r
i
a
l
/
s
i
m
p
l
e
S
o
a
p
S
e
r
v
i
c
e
"
/
>
<
/
w
s
d
l
:
p
o
r
t
>
<
/
w
s
d
l
:
s
e
r
v
i
c
e
>
<
/
w
s
d
l
:
d
e
f
i
n
i
t
i
o
n
s
>
WSDL structure
WSDL structure
Project Structure
Maven Project Structure
Deployable WAR file Structure
Web services written by apply REST Architectural concept are called RESTful web
services which focus on System resources and how state of Resource should be
transferred over http protocol to a different clients written in different languages. In
RESTful web services http methods like GET, PUT, POST and DELETE can can be used
to perform CRUD operations.
What is differences between RESTful web services and SOAP web services ?
Though both RESTful web series and SOAP web service can operate cross platform
they are architecturally different to each other, here is some of differences between
REST and SOAP:
What are the tools used for creating RESTFull web services ?
You can use AJAX(Asynchronous JavaScript with XAML) and Direct Web Removing to
consume web serives in web application. Both Eclipse and NetBeans also supported
development of RESTFul services.
Define SOAP?
SOAP is an XML based protocol to transfer between computers.
Define WSDL?
It means Web Services Description Language. It is basically the service description
layer in the web service protocol stock. The Service Description layer describes the
user interface to a web service.
Differentiate between a SOA and a Web service?
SOA is a design and architecture to implement other services. SOA can be easily
implemented using various protocols such as HTTP, HTTPS, JMS, SMTP, RMI, IIOP,
RPC etc. While Web service, itself is an implemented technology. In fact one can
implement SOA using the web service.
If you have to choose one approach, then what will be your choice?
In my point of view, the first approach that is the contract-first approach is more
feasible as compared to the second one but still it depends on other factors too.
http://www.tutorialspoint.com/webservices/webservices_interview_questions.htm
http://www.javatpoint.com/web-services-interview-questions
There is given frequently asked Web Services interview questions and answers that has
been asked in many companies. Let's see the list of top Web Services interview questions.
Web Service is a software system for communicating two devices over the network. More
details...
Interoperability: By the help of web services, an application can communicate with other
application developed in any language.
Reuability: We can expose the web service so that other applications can use it.
Modularity: By the help of web service, we can create a service for a specific task such as tax
calculation etc.
More details...
3) What are the different types of web services?
SOAP
RESTful
4) What is SOAP?
SOAP stands for Simple Object Access Protocol. It is a XML-based protocol for accessing web
services. More details...
WS Security
Language Independent
Platform Independent
More details...
6) What are the disadvantages of SOAP web services?
Slow
WSDL Dependent
More details...
7) What is WSDL?
WSDL stands for Web Services Description Language. It is a xml document containing
information about web services such as method name, method parameter etc. More
details...
8) What is UDDI?
UDDI stands for Universal Description, Discovery and Integration. It is a XML based
framework for describing, discovering and integrating web services. It contains a list of
available web services. WSDL is the part of UDDI. More details...
REST stands for REpresentational State Transfer. It is a architectural style. It is not a protocol
like SOAP. More details...
Fast
Language Independent
Platform Independent
Can use SOAP.
Allows different data format.
More details...
11) What is the difference between SOAP and REST web services?
SOA stands for Service Oriented Architecture. It is a design pattern to provide services to
other application through protocol. More details...
13) What tools are used to test web services?
http://career.guru99.com/top-50-web-services-interview-questions/
The security level for web services should be more than that of what we say Secure
Socket Layer (SSL). This level of security can be only achieved from Entrust Secure
Transaction Platform. Web services need this level of security to ensure reliable
transactions and secure confidential information .
10) Do you have any idea about foundation security services?
As implies from its name, these services are the foundation or basics of integration,
authentication, authorization, digital signatures and encryption processes.
11) Define Entrust Identification Service?
Entrust Identification Service comes from the Entrust Security Transaction Platform.
This platform allows companies to control the identities that are trusted to perform
transactions for Web services transactions.
12) What UDDI means?
UDDI stands for Universal, Description, Discovery, and Integration. It is the discovery
layer in the web services protocol stack.
13) Define Entrust Entitlements Service?
This service verifies entities that attempt to access a web service. For Example, the
authentication service, the Entitlements Service ensures security in business
operations.
14) Define Entrust Privacy Service?
As its name implies, it deals with security and confidentiality. This service encrypts
data to ensure that only concerned parties can access the data.
15) What do you mean by PKI?
It means Public-Key Infrastructure.
16) What tools are used to test a web service?
I have used SoapUI for SOAP WS and Firefox poster plugin for RESTFul Services.
17) Differentiate between a SOA and a Web service?
SOA is a design and architecture to implement other services. SOA can be easily
implemented using various protocols such as HTTP, HTTPS, JMS, SMTP, RMI, IIOP,
RPC etc. While Web service, itself is an implemented technology. In fact one can
implement SOA using the web service.
18) Discuss various approaches to develop SOAP based web service?
We can develop SOAP based web service with two different types of approaches
such as contract-first and contract-last. In the first approach, the contract is defined
first and then the classes are derived from the contract while in the later one, the
classes are defined first and then the contract is derived from these classes.
19) If you have to choose one approach, then what will be your choice?
In my point of view, the first approach that is the contract-first approach is more
feasible as compared to the second one but still it depends on other factors too.
20) Is there any special application required to access web service?
No, you don’t need to install any special application to access web service. You can
access web service from any application that supports XML based object request and
response.
21) Can you name few free and commercial implementations for web services?
The implementations I know are Apache SOAP, JAX-WS Reference Implementation,
JAX-RS Reference Implementation, Metro, Apache CXF, MS.NET and Java 6.
22) Name browser that allows access to web service?
JavaScript XmlHttpRequest object is required to access web service via browsers.
The browsers that support this object are Internet Explorer, Safari and Mozilla-based
browsers like FireFox.
23) What is REST?
REST stands for Representational State Transfer. REST itself is not a standard, while it
uses various standards such as HTTP, URL, XML/HTML/GIF/JPEG (Resource
Representations) and text/xml, text/html, image/gif, image/jpeg, etc (MIME Types).
24) How one can provide API to users?
To provide an API to the users, one can easily do this with an “open table”. All you
need to do is to write open table which is basically an XML schema that point to a
web service.
25) Name the various communication channels in web service?
Web service is integrated with three protocols such as HTTP/POST, HTTP/GET, and
SOAP. It provides three different communication channels to clients. Client can
choose any communication method as per requirements.
http://www.careerride.com/Interview-Questions-Java-Web-services.aspx
Explain each web service technologies - SOAP, WSDL, UDDI, eBXML and JAX pack
Web service technologies - SOAP, WSDL, UDDI, eBXML and JAX pack - SOAP: Simple Object Access Proto
protocol that is used to exchange structured information at the time of implementing a web service....
Technologies included within JAX pack, i.e. JAXP, JAXB, JAXM, JAX-RPC, JAXR
JAX pack technologies - JAXP: Java API for xml processing. It provides the validation capability and parsin
documents...
Explain the web services architecture
Web services architecture - The operations between different software applications, which are running o
variety of platforms and frameworks are supported by a standard called Web services....
What are smart web services?
What are smart web services? - A smart web service understands the situational context and capable of
the context with other services....
Java Web Services: What is Web Services
Web Services are the components that provide functionality via internet, uses standard protocol..
Java Web Service: What is SOAP?
SOAP is an XML-based protocol that enables 2 components to communicate each other..
Explain JAXR
JARX is a standard API that are used to access XML registries (list of services available on the web) from t
platform..
Explain JAX-RPC.
JAX-RPC uses SOAP to call remote procedures. JAX-RPC...
What are Web Services?
What are Web Services? - Web services exposes functionality over internet using protocol such as HTTP.
Web Services: Define UDDI, DISCO and WSDL.
UDDI, Universal description, discovery and integration,DISCO, Discovery,WSDL, Web Service description
language....
Explain JAXM messaging models.
JAXM messaging models has two types of messaging model, synchronous and asynchronous..
http://www.journaldev.com/9193/web-services-interview-questions-soap-and-rest
What are the advantages of Web Services?
Some of the advantages of web services are:
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.
Reusability: One web service can be used by many client applications at the
same time.
Loose Coupling: Web services client code is totally independent with server
code, so we have achieved loose coupling in our application.
Easy to deploy and integrate, just like web applications.
Multiple service versions can be running at same time.
What are different types of Web Services?
There are two types of web services:
SOAP Web Services: Runs on SOAP protocol and uses XML technology for
sending data.
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.
What is SOAP?
SOAP stands for Simple Object Access Protocol. SOAP is an XML
based industry standard protocol for designing and developing web services.
Since it’s XML based, it’s platform and language independent. So our server
can be based on JAVA and client can be on .NET, PHP etc. and vice versa.
What are advantages of SOAP Web Services?
SOAP web services have all the
advantages that web services has, some of the additional advantages are:
WSDL document provides contract and technical details of the web
services for client applications without exposing the underlying
implementation technologies.
SOAP uses XML data for payload as well as contract, so it can be easily read
by any technology.
SOAP protocol is universally accepted, so it’s an industry standard
approach with many easily available open source implementations.
What are different components of WSDL?
Some of the different tags in WSDL xml
are:
xsd:import namespace and schemaLocation: provides WSDL URL and
unique namespace for web service.
message: for method arguments
part: for method argument name and type
portType: service name, there can be multiple services in a wsdl document.
operation: contains method name
soap:address for endpoint URL.
What is difference between Top Down and Bottom Up approach in SOAP Web
Services?
In Top Down approach first WSDL document is created to establish
the contract between web service and client and then code is written, it’s
also termed as contract first approach. This is hard to implement because
classes need to be written to confirm the contract established in WSDL.
Benefit of this approach is that both client and server code can be written in
parallel.
In Bottom Up approach, first web service code is written and then
WSDL is generated. It’s also termed as contract last approach. This approach
is easy to implement because WSDL is generated based on code. In this
approach client code have to wait for WSDL from server side to start their
work.
What are advantages of REST web services?
Some of the advantages of REST web
services are:
Learning curve is easy since it works on HTTP protocol
Supports multiple technologies for data transfer such as text, xml, json,
image etc.
No contract defined between server and client, so loosely coupled
implementation.
REST is a lightweight protocol
REST methods can be tested easily over browser.
What are different ways to test web services?
SOAP web services can be tested
programmatically by generating client stubs from WSDL or through software
such as Soap UI.
REST web services can be tested easily with program, curl
commands and through browser extensions. Resources supporting GET
method can be tested with browser itself, without any program.
What is the use of Accept and Content-Type Headers in HTTP Request?
These are
important headers in Restful web services. Accept headers tells web service
what kind of response client is accepting, so if a web service is capable of
sending response in XML and JSON format and client sends Accept header as
“application/xml” then XML response will be sent. For Accept header
“application/json”, server will send the JSON response.
Content-Type header
is used to tell server what is the format of data being sent in the request. If
Content-Type header is “application/xml” then server will try to parse it as
XML data. This header is useful in HTTP Post and Put requests.
Quick Adsense WordPress Plugin: http://quicksense.net/
CM_JD_AP_Bottom_Responsive
How would you choose between SOAP and REST web services?
Web Services
work on client-server model and when it comes to choose between SOAP and
REST, it all depends on project requirements. Let’s look at some of the
conditions affecting our choice:
Do you know your web service clients beforehand? If Yes, then you can
define a contract before implementation and SOAP seems better
choice. But if you don’t then REST seems better choice because you
can provide sample request/response and test cases easily for client
applications to use later on.
How much time you have? For quick implementation REST is the best
choice. You can create web service easily, test it through browser/curl
and get ready for your clients.
What kind of data format are supported? If only XML then you can go with
SOAP but if you think about supporting JSON also in future then go
with REST.
What is JAX-WS API?
JAX-WS stands for Java API for XML Web Services. JAX-WS is
XML based Java API to build web services server and client application. It’s
part of standard Java API, so we don’t need to include anything else which
working with it. Refer to JAX-WS Tutorial for a complete example.
Name some frameworks in Java to implement SOAP web services?
We can create
SOAP web services using JAX-WS API, however some of the other frameworks
that can be used are Apache Axis and Apache CXF. Note that they are not
implementations of JAX-WS API, they are totally different framework that
work on Servlet model to expose your business logic classes as SOAP web
services. Read more at Java SOAP Web Service Eclipse example.
R
I
'
s
v
e
r
s
i
o
n
i
s
J
A
X
-
W
S
R
I
2
.
2
.
1
0
s
v
n
-
r
e
v
i
s
i
o
n
#
9
1
9
b
3
2
2
c
9
2
f
1
3
a
d
0
8
5
a
9
3
3
e
8
d
d
6
d
d
3
5
d
4
9
4
7
3
6
4
b
.
-
-
>
<
!
-
-
G
e
n
e
r
a
t
e
d
b
y
J
A
X
-
W
S
R
I
(
h
t
t
p
:
/
/
j
a
x
-
w
s
.
j
a
v
a
.
n
e
t
)
.
R
I
'
s
v
e
r
s
i
o
n
i
s
J
A
X
-
W
S
R
I
2
.
2
.
1
0
s
v
n
-
r
e
v
i
s
i
o
n
#
9
1
9
b
3
2
2
c
9
2
f
1
3
a
d
0
8
5
a
9
3
3
e
8
d
d
6
d
d
3
5
d
4
9
4
7
3
6
4
b
.
-
-
>
<
d
e
f
i
n
i
t
i
o
n
s
x
m
l
n
s
:
w
s
u
=
"
h
t
t
p
:
/
/
d
o
c
s
.
o
a
s
i
s
-
o
p
e
n
.
o
r
g
/
w
s
s
/
2
0
0
4
/
0
1
/
o
a
s
i
s
-
2
0
0
4
0
1
-
w
s
s
-
w
s
s
e
c
u
r
i
t
y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
p
c
"
/
>
<
o
p
e
r
a
t
i
o
n
n
a
m
e
=
"
s
a
y
H
e
l
l
o
"
>
<
s
o
a
p
:
o
p
e
r
a
t
i
o
n
s
o
a
p
A
c
t
i
o
n
=
"
"
/
>
<
i
n
p
u
t
>
<
s
o
a
p
:
b
o
d
y
u
s
e
=
"
l
i
t
e
r
a
l
"
n
a
m
e
s
p
a
c
e
=
"
h
t
t
p
:
/
/
s
e
r
v
i
c
e
.
j
a
x
w
s
.
j
o
u
r
n
a
l
d
e
v
.
c
o
m
/
"
/
>
<
/
i
n
p
u
t
>
<
o
u
t
p
u
t
>
<
s
o
a
p
:
b
o
d
y
u
s
e
=
"
l
i
t
e
r
a
l
"
n
a
m
e
s
p
a
c
e
=
"
h
t
t
p
:
/
/
s
e
r
v
i
c
e
.
j
a
x
w
s
.
j
o
u
r
n
a
l
d
e
v
.
c
o
m
/
"
/
>
<
/
o
u
t
p
u
t
>
<
/
o
p
e
r
a
t
i
o
n
>
<
/
b
i
n
d
i
n
g
>
<
s
e
r
v
i
c
e
n
a
m
e
=
"
T
e
s
t
S
e
r
v
i
c
e
S
e
r
v
i
c
e
"
>
<
p
o
r
t
n
a
m
e
=
"
T
e
s
t
S
e
r
v
i
c
e
P
o
r
t
"
b
i
n
d
i
n
g
=
"
t
n
s
:
T
e
s
t
S
e
r
v
i
c
e
P
o
r
t
B
i
n
d
i
n
g
"
>
<
s
o
a
p
:
a
d
d
r
e
s
s
l
o
c
a
t
i
o
n
=
"
h
t
t
p
:
/
/
l
o
c
a
l
h
o
s
t
:
8
8
8
8
/
t
e
s
t
W
S
"
/
>
<
/
p
o
r
t
>
<
/
s
e
r
v
i
c
e
>
<
/
d
e
f
i
n
i
t
i
o
n
s
>
Notice that types element is empty and we can’t validate it against any schema.
Now just change the SOAPBinding.Style.RPC to
SOAPBinding.Style.DOCUMENT and you will get below WSDL.
document.xml
1
2 <
?
3 x
m
4 l
5 v
e
6 r
s
7 i
o
8 n
=
9 '
1
1 .
0 0
'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
s
=
"
0
"
/
>
<
/
x
s
:
s
e
q
u
e
n
c
e
>
<
/
x
s
:
c
o
m
p
l
e
x
T
y
p
e
>
<
x
s
:
c
o
m
p
l
e
x
T
y
p
e
n
a
m
e
=
"
s
a
y
H
e
l
l
o
R
e
s
p
o
n
s
e
"
>
<
x
s
:
s
e
q
u
e
n
c
e
>
<
x
s
:
e
l
e
m
e
n
t
n
a
m
e
=
"
r
e
t
u
r
n
"
t
y
p
e
=
"
x
s
:
s
t
r
i
n
g
"
m
i
n
O
c
c
u
r
s
=
"
0
"
/
>
<
/
x
s
:
s
e
q
u
e
n
c
e
>
<
/
x
s
:
c
o
m
p
l
e
x
T
y
p
e
>
<
/
x
s
:
s
c
h
e
m
a
>
So here WSDL document can be validated against the schema definintion.
How to get WSDL file of a SOAP web service?
WSDL document can be accessed by
appending ?wsdl to the SOAP endoint URL. In above example, we can access
it at http://localhost:8888/testWS?wsdl location.
What is JAX-RS API?
Java API for RESTful Web Services (JAX-RS) is the Java API for
creating REST web services. JAX-RS uses annotations to simplify the
development and deployment of web services. JAX-RS is part of JDK, so you
don’t need to include anything to use it’s annotations.
What is wsimport utility?
We can use wsimport utility to generate the client
stubs. This utility comes with standard installation of JDK. Below image shows
an example execution of this utility for one of JAX-WS project.
<img src="http://1988780851.rsc.cdn77.org/wp-
content/uploads/2015/10/wsimport-utility-parse-wsdl-450x293.png"
alt="wsimport-utility-parse-wsdl" width="450" height="293"
class="aligncenter size-medium wp-image-9129"
srcset="http://1988780851.rsc.cdn77.org/wp-
content/uploads/2015/10/wsimport-utility-parse-wsdl-450x293.png 450w,
http://1988780851.rsc.cdn77.org/wp-content/uploads/2015/10/wsimport-
utility-parse-wsdl-1024x667.png 1024w,
http://1988780851.rsc.cdn77.org/wp-content/uploads/2015/10/wsimport-
utility-parse-wsdl-700x456.png 700w, http://1988780851.rsc.cdn77.org/wp-
content/uploads/2015/10/wsimport-utility-parse-wsdl-150x98.png 150w,
http://1988780851.rsc.cdn77.org/wp-content/uploads/2015/10/wsimport-
utility-parse-wsdl.png 1176w" sizes="(max-width: 450px) 100vw, 450px" />
http://java67.blogspot.in/2015/09/top-10-restful-web-service-interview-questions-
answers.html
Question 4 : Can you tell me which API can be used to develop RESTFul web service
in Java?
Answer : There are many framework and libraries out there which helps to develop
RESTful web services in Java including JAX-RS which is standard way to develop REST
web services. Jersey is one of the popular implementation of JAX-RS which also
offers more than specification recommends. Then you also have RESTEasy, RESTlet
and Apache CFX. If you like Scala then you can also use Play framework to develop
RESTful web services.
Question 7 : Have you used securing RESTful APIs with HTTP Basic Authentication
Question 9 : Have you used Jersey API to develop RESTful services in Java?
Answer : Jersey is one of the most popular framework and API to develop REST
based web services in Java. Since many organization uses Jersey they check if
candidate has used it before or not. It's simple to answer, say Yes if you have really
used and No, if you have not. In case of No, you should also mention which
framework you have used for developing RESTful web services e.g. Apache CFX, Play
or Restlet.
Question 15 : How much maximum pay load you could do in POST method?
Answer : If you remember difference between GET and POST request then you know
that unlike GET which passes data on URL and thus limited by maximum URL length,
POST has no such limit. So, theoretically you can pass unlimited data as payload to
POST method but you need to take practical things into account e.g. sending POST
with large payload will consume more bandwidth, take more time and present
performance challenge to your server.
That's all in this list of some good RESTful web service interview questions for Java
developers. Though this list is meant for Java developer, you can use this questions
to check any candidate's knowledge on REST style web services independent of
programming language because REST doesn't say that you need to implement web
service in Java only. Since it take advantage of ubiquitous HTTP protocol you can
build backed with any web technology stack e.g. Java, .NET or any other.