Webservice Questions


web services Interview Questions :-

  What are web services ?

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.


  What are Main characteristics of the Web Services ?

Main characteristics of the Web Services are :

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 .


  What is the difference between SOA and a web service?

SOA (Service-Oriented Architecture) is an architectural pattern that makes possible for services to interact with one another independently.

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.


  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.


  What is the difference between a REST web service and a SOAP web service?

Below are the main differences between REST and SOAP web service

1. REST supports different formats like text, JSON and XML; SOAP only supports XML;

2. REST works only over HTTP(S) on a transport layer; SOAP can be used different protocols on a transport layer;

3. 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;

4. SOAP based reads can't be cached, for SOAP need to provide caching; REST based reads can be cached;

5. SOAP supports SSL security and WS-security(Web Service-security); REST only supports SSL security;

6. SOAP supports ACID (Atomicity, Consistency, Isolation, Durability); REST supports transactions, but it is neither ACID compliant nor can provide two phase commit.


  Give me an example of real web service?

One example of web services is IBM Web Services browser. You can get it from IBM Alphaworks site. This browser shows various demos related to web services. Basically web services can be used with the help of SOAP, WSDL, and UDDI .

All these, provide a plug-and-play interface for using web services such as stock-quote service, a traffic-report service, weather service etc.


  What is REST and RESTful web services ?

this is the first REST interview question on most of interviews as not everybody familiar with REST and also start discussion based on candidates response.

Anyway REST stands for REpresentational State Transfer (REST) its a relatively new concept of writing web services which enforces a stateless client server design where web services are treated as resource and can be accessed and identified by there URL unlike SOAP web services which were defined by WSDL.

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:

1. REST is more simple and easy to use than SOAP

2. REST uses HTTP protocol for producing or consuming web services while SOAP uses XML.

3. REST is lightweight as compared to SOAP and preferred choice in mobile devices and PDA's.

4. REST supports different format like text, JSON and XML while SOAP only support XML.

5. REST web services call can be cached to improve performance.


  What is Restlet framework ?

Restlet is leading RESTful web framework for Java applications is used to build RESTFul web services it has two part Restlet API and a Restlet implementation much like Servlet specification.

There are many implementation of Restlet framework available you just need to add there jar in your classpath to use them. By using Restlet web framework you can write client and server.


  What is Resource in REST framework ?

it represent a "resource" in REST architecture. on RESTLET API it has life cycle methods like init(), handle() and release() and contains a Context, Request and Response corresponding to specific target resource.

This is now deprecated over ServerResource class and you should use that. see Restlet documentation for more details.


  How to display custom error pages using RestFull web services ?

In order to customize error you need to extend StatusService and implement getRepresentation(Status, Request, Response) method with your custom code now assign instance of your CustomStatusService to appropriate "statusService property".


  Which HTTP methods are supported by RestFull web services ?

Another common REST interview questioning RESTFul web service each Resource supports GET, POST, PUT and DELETE http methods.GET is mapped to represent(), POST - acceptRepresentation(), PUT- storeRepresentation and DELET for rmeoveRepresentation.


  What is difference between top-down and bottom-up approach of developing web services ?

In top-down approach first WSDL document is created and than Java classes are developed based on WSDL contract, so if WSDL contract changes you got to change your Java classes while in case of bottom up approach of web service development you first create Java code and then use annotations like @WebService to specify contract or interface and WSDL field will be automatically generated from your build.


  How to decide which one of web service to use REST or SOAP?

"REST vs SOAP" we can rephrased to "Simplicity vs Standard". Of course, "Simplicity" with REST at most cases wins, it wins in performance, scalability and support for multiple data formats, but SOAP is favored where service requires comprehensive support for security (WS-security) and transactional safety (ACID).


  Can you define each of these layers of protocol stack?

The Service Transport layer transfer messages between different applications, such as HTTP, SMTP, FTP, and Blocks Extensible Exchange Protocol (BEEP). The XML Messaging layer encodes messages in XML format so that messages can be understood at each end, such as XML-RPC and SOAP.

The Service Description layer describes the user interface to a web service, such as WSDL. The Service Discovery layer centralizes services to a common registry and offer simple publish functionality, such as UDDI.


  What kind of security is needed for web services?

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 .


  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.


  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.

  What UDDI means?

UDDI stands for Universal, Description, Discovery, and Integration. It is the discovery layer in the web services protocol stack.

  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.


  What are web services components?

There are 3 main components web services (mainly SOAP based).

SOAP: SOAP stands for Simple Object Access Protocol. It define architecture and formats of request/response messages. The web-service request and response both are transmitted as SOAP message (xml) over HTTP.

WSDL: Web Services Description Language (WSDL) is a xml document which is used as a formal contract to describe the interface that a web service offers. It may include operations, messages, bindings and location of the web service (end point).

UDDI: Universal Description and Discovery Integration.


  What is structure of WSDL document?

A WSDL document describes web-service using below elements:

WSDL 1.1 : types, messages, portType(operation - input, output), binding, service(port).

WSDL 2.0 : types, interface(operation - input, output), binding, service(endpoint).

Its easy to remember these elements with an analogy to java class:

portType is equivalent to name of class.

Each operation in portyType gives name of a method in the class.

The input and output tags inside operation corresponds to input parameter and return value.

types and messages define structure of these input, output in xml.

service element provides url where the web-service is hosted.


  What is Apache Axis?

Apache Axis is a web services framework which provides implementation of JAX-RPC(Axis 1.x) and JAX-WS(Axis 2) web services specifications.


  What is apache CXF?

Apache CXF is a web services framework which provides implementation of JAX-WS and JAX-RS web services specifications.


  How to expose a web service using CXF?

Apache CXF is a web services framework which provides implementation of JAX-WS and JAX-RS web services specifications.


  What are advantages of using REST over SOAP?

REST is more simple and easy to use than SOAP. REST language is based on use of nouns and verbs (better readability)

REST is lightweight as compared to SOAP.

REST supports different format like text, JSON and XML while SOAP only support XML.

Does the service expose data or business logic? (REST is a better choice for exposing data, SOAP WS might be a better choice for logic).Do the consumers and the service providers require a formal contract? (SOAP has a formal contract via WSDL)

SOAP WS supports both SSL security and WS-security, which adds some enterprise security features like maintaining security right up to the point where it is needed, maintaining identities through intermediaries and not just point to point SSL only, securing different parts of the message with different security algorithms, etc. The REST supports only point-to-point SSL security. The SSL encrypts the whole message, whether all of it is sensitive or not.


  How do you decide which type of web service to use REST or SOAP?

SOAP has better support security. SOAP has better support for ACID transactions management. SOAP has formal contract via WSDL. for everything else REST is better. Does the service expose data or business logic? REST is a better choice for exposing data, SOAP WS might be a better choice for logic. Do the consumers and the service providers require a formal contract? (SOAP has a formal contract via WSDL)

SOAP WS supports both SSL security and WS-security, which adds some enterprise security features like maintaining security right up to the point where it is needed, maintaining identities through intermediaries and not just point to point SSL only, securing different parts of the message with different security algorithms, etc.

The REST supports only point-to-point SSL security. The SSL encrypts the whole message, whether all of it is sensitive or not. XMethods directory of web services. IBM web services browser on IBM Alphaworks site.


  What does SOAP encodingStyle attribute defines?

SOAP encodingStyle defines the serialization rules used in a SOAP message. This attribute may appear on any element, and is scoped to that element's contents and all child elements not themselves containing such an attribute. There is no default encoding defined for a SOAP message.


  What is encoding rules for header entries?

1. a header entry is identified by its fully qualified element name, which consists of the namespace URI and the local name. All immediate child elements of the SOAP Header element must be namespace-qualified.

2. the SOAP encodingStyle attribute may be used to indicate the encoding style used for the header entries.

3.the SOAP mustUnderstand attribute and SOAP actor attribute may be used to indicate how to process the entry and by whom.


  What is the wsimport tool?

The wsimport tool is used to parse an existing Web Services Description Language (WSDL) file and generate required files (JAX-WS portable artifacts) for web service client to access the published web services:


  What is the wsgen tool?

` 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.


  What is the difference between SOAP and other remote access techniques?

1. SOAP is simple to use and it is non - symmetrical unlike DCOM or CORBA is highly popular and usually have complexity in them.

2. SOAP provides greater platform independent with the language independence unlike DCOM or CORBA doesn't provide any of these.

3. SOAP uses HTTP as its transport protocol and the data are being saved in XML format that can be ready by human, whereas DCOM or CORBA have their own binary formats that are used to transport the data in complicated manner. SOAP identify the object other than URL endpoint. SOAP objects are stateless and it is hard to maintain that. Whereas, it is not hard to maintain in case of other remote access techniques.


  What are HTTP methods supported by REST?

1. GET;

2. POST;

3. PUT;

4. DELETE;

5. OPTIONS;

6. HEAD;


  What is the Restlet framework?

Restlet is a lightweight, comprehensive, open source RESTful web API framework for the Java platform.

It has advantages such as

1. websocket and server-sent events support;

2. HTTP/2 support;

3. transparent HTTP PATCH support;

4. client cache service;

5. fluent APIs.


  What is the Jersey framework?

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 and JSR 339) Reference Implementation.

It has advantages such as

1. contains support for Web Application Description Language (WADL);

2. contains Jersey Test Framework which lets run and test Jersey REST services inside JUnit;

3. supports for the REST MVC pattern, which would allow to return a View from Jersey services rather than just data.


  What is the RESTeasy framework?

RESTeasy is a JBoss project, which implements of the JAX-RS specification.

It has advantages such as

1. fully certified JAX-RS implementation; supports HTTP 1.1 caching semantics including cache revalidation;

2. JAXB marshalling into XML, JSON, Jackson, Fastinfoset, and Atom as well as wrappers for maps, arrays, lists, and sets of JAXB Objects;

3. OAuth2 and Distributed SSO with JBoss AS7;

3. rich set of providers for: XML, JSON, YAML, Fastinfoset, Multipart, XOP, Atom, etc.


  What is the difference between AJAX and REST?

1. in Ajax, the request are sent to the server by using XMLHttpRequest objects; REST have a URL structure and a request/response pattern the revolve around the use of resources;

2. Ajax eliminates the interaction between the customer and server asynchronously; REST requires the interaction between the customer and server;

3. Ajax is a set of technology; REST is a type of software architecture and a method for users to request data or information from servers.


Hello!

Let's do interview preparation for node.js..

Read more