.NET - Web Services Interview Questions


Q. What is a "Web Service"?
A. A "Web Service" is a .NET component that replies to HTTP requests that are formatted using SOAP syntax.
  Web services are one of the cornerstones of the .NET initiative in that they allow a degree of interoperability among applications over the internet that was inconceivable before.
top ^
Q. How are web services implemented in .NET?
A. Web services are implemented as HTTP Handlers that intercept requests to .asmx files.
top ^
Q. What are the drawbacks of "Response Caching"?
A.
  • If the method or accepts a wide range of values, response caching might be inefficient or even wasteful because a great deal of information might be stored in caching.
  • If the method depends on other information not supplied in parameters (like user authentication or session data), it will be bypassed.
  • The method will be bypassed even if it needs to perform actions other than returning values (like writing to a log file)
top ^
Q. How to overcome the limitations of response caching while providing an acceptable level of caching?
A. By using data caching (System.Web.Caching.Cach)
top ^
Q. What are the protocols supported by web services built with ASP.NET to exchange data?
A.
  • HTTP GET
  • HTTP POST
  • SOAP
top ^
Q. What are the limitations of using GET & POST to communicate with a web service?
A.
  • It is less secured than SOAP.
  • It prevents the user from passing structures and objects as arguments
  • It prevents the user from passing ByRef arguments
top ^
Q. How to make a class accessible as a web service?
A.
  • By making the class inherits from the System.Web.Services.WebService class
  • By qualifying the class with the WebService attribute
  Inheriting from the WebService class is beneficiary in that it allows the class to access the ASP.NET context and other useful objects such as the session and application objects. On the other hand, qualifying the class with the WebService attribute allows for setting additional properties of the web service such as its description and namespace.
 
C# [WebService] public class TestService : System.Web.Services.WebService
VB <WebService> _ Public Class TestService Inherits System.Web.Services.WebService
top ^
Q. How to make a method of a web service class accessible through the internet?
A. By qualifying the method with the WebMethod attribute.
 
C# [WebMethod()] public string MethodName()
VB <WebMethod()> _ Public Function MethodName() As String
top ^