web Service Interview question

What is the Web Service

Web services are business logic component which provide functionality via the Internet using standard protocols such as HTTP.

Web Service uses Simple Object Access Protocol in order to expose the business functionality.

Web services are application component. The accessibility to provide the features across different platforms that are developed using different languages, and can be used by any remote application, over the internet, etc., makes the web service more useful at times by means of providing the user only the specific and relevant information, avoiding the accessibility to resources that have to be securely maintained.

  • Web services are application component
  • Web services are using open protocols
  • Web services are self contained and self describing
  • Web services can be discovered using UDDI
  • Web Services can be used by other application
  • XML is the basis for Web Services

Uses of Web Service

Reusable application-components

There are things applications need very often. So why make these over and over again?

Web services can offer application-component like: currency conversion, weather reports, or even language translation as services.

Connect existing software

Web services can help to solve the interoperability problem by giving different applications a way to link their data.
With Web services you can exchange data between different applications and different platforms.

What is SOAP?

SOAP is an XML-based protocol to let applications exchange information over HTTP.
Or more simple: SOAP is a protocol for accessing a Web Service.

  • SOAP stands for Simple Object Access Protocol
  • SOAP is a communication protocol
  • SOAP is a format for sending messages
  • SOAP is a designed to communicate via Internet
  • SOAP is platform independent
  • SOAP is based on XML
  • SOAP is simple and extensible
  • SOAP allows you to get around firewalls
  • SOAP is a W3C standard

What is WSDL?

XML grammar for describing Web Service.
– Where we can find the Web Service (its URI)?
– What are the methods and properties that service supports?
– Data type supports
– Supported protocols
WSDL is an XML-based language for locating and describing Web services.
– WSDL stands for Web Services Description Language
– WSDL is based on XML
– WSDL is used to describe Web services
– WSDL is used to locate Web services
– WSDL is a W3C standard

What is UDDI?

It is a directory that can be used to publish and discover public Web Services.
UDDI is a directory service where companies can register and search for Web services.
– UDDI stands for Universal Description, Discovery and Integration
– UDDI is a directory for storing information about web services
– UDDI is a directory of web service interfaces described by WSDL
– UDDI communicates via SOAP
– UDDI is built into the Microsoft .Net platform

What is DISCO?

DISCO is abbreviated form of Discovery. It is basically used to club or group common services together on a server and provides links to the schema documents of the services it describes many reuires.

Using Web Method attributes

– BufferResponse
– CacheDuration
– Description
– EnableSession
– MessageName
– TransactionOption


True if the response for this request is buffered; otherwise false. The default is true.
Setting BufferResponse is true, serializes the response of the web service method into the memory buffer until either the response is completely serialized or buffer is full. Once the response is buffered, it is returned to the XML web service client over the network.
When the BufferResponse response is false the response to the XML web service method is sent back to the client as it is serialized.


The number of second response should be held in the cache. The default is 0, which means response is not catched


Description of the web method


Default is false

In order to store session state in the Asp.Net HttpSessionState object, the XML web service must inherit from WebService and a WebMethod attributes applied to the XML web service method, setting the EnableSession property to true.

An XML Web service client is uniquely identified by an HTTP cookie returned by an XML Web service. In order for an XML Web service to maintain session state for a client, the client must persist the cookie. Clients can receive the HTTP cookie by creating a new instance of CookieContainer and assigning that to the CookieContainer property of the proxy class before calling the XML Web service method. If you need to maintain session state beyond when the proxy class instance goes out of scope, the client must persist the HTTP cookie between calls to the XML Web service. For instance, a Web Forms client can persist the HTTP cookie by saving the CookieContainer in its own session state. Because not all XML Web services use session state and thus clients are not always required to use the CookieContainer property of a client proxy, the documentation for the XML Web service should state whether session state is used.


SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks. It relies on Extensible Markup Language (XML) as its message format, and usually relies on other Application Layer protocols (most notably Remote Procedure Call (RPC) and HTTP) for message negotiation and transmission. SOAP can form the foundation layer of a web services protocol stack, providing a basic messaging framework upon which web services can be built.
As a layman’s example of how SOAP procedures can be used, a SOAP message could be sent to a web service enabled web site (for example, a house price database) with the parameters needed for a search. The site would then return an XML-formatted document with the resulting data (prices, location, features, etc). Because the data is returned in a standardized machine-parseable format, it could then be integrated directly into a third-party site.
The SOAP architecture consists of several layers of specifications for message format, message exchange patterns (MEP), underlying transport protocol bindings, message processing models, and protocol extensibility. SOAP is the successor of XML-RPC, though it borrows its transport and interaction neutrality and the envelope/header/body from elsewhere (probably from WDDX).

Consume Web Services

– Web References
– Proxy Class
– SOAP request

Explain the different ways to secure the web service

Method overloading in Web Service
Web service is basically totally based on XML so XML does not provide functionality to overload the web services. To resolve this issue .Net provide Message Name property in Web Method attribute.
So in code it looks as method overload but internally it will identify through message name.


//Incorrect code
public class OverloadingInWebService : System.Web.Services.WebService 
    public int Add(int a, int b) 
        return (a + b); 
    public float Add(float a, float b) 
        return (a + b); 

//above code compile successfully but at runtime it will give exception.

//Correct code
public class OverloadingInWebService : System.Web.Services.WebService 
    [WebMethod(MessageName = "AddInt")] 
    public int Add(int a, int b) 
        return (a + b); 
    [WebMethod(MessageName = "AddFloat")] 
    public float Add(float a, float b) 
        return (a + b); 

Web Services Interopability Organization’s (WS-I) Baisc Profile 1.1. The Basic Profile defines a set of rules to which your webservice must conform.
One of its rules is that the webservice May Not Include Method Overloading. If you run a webservice that uses method overloading, you will receive an errormessage telling that your service is not conform to WS-I Basic Profile v1.1:

So you have to add one more line top of the class as:

[WebServiceBinding(ConformsTo = WsiProfiles.None)]

How you will manage the session in Web Service?

What is the use of Authentication header in Web Service?

Please let me know if you have any query related to Web Service.

Tagged with: , , , , , , , ,
Posted in .Net, Asp.Net, C#, Web Service
One comment on “web Service Interview question
  1. Before conducting the interview, I wrote up a list of technical questions I wanted to ask. Madelyn Webservice

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Top Rated

Error: Please make sure the Twitter account is public.

Blog Stats
  • 30,631 hits
%d bloggers like this: