Monday, 17 March 2014

Interview Q & A on Web Service in Asp.Net(Part 1)

1.What is a Web Service ?

 It is a set of specification or standards provided by to achieve cross platform and cross software(language) integration .

 Web service is a class managed by webserver and accessable to different client apps based on open industry standards

2.what are different approaches to work with dis tributed technology?

 Different approaches given by different companies to work with distributed technology are:
   1.DCOM(Distributed COM)
   2.RMI(Remote Method Invocation)
   3.CORBA (Common Object Request Broker Architecture)
   4.Remoting

3.Which attribute is used in order that the method can be used as WebService ?

 WebMethod attribute has to be specified in order that the method and property can be treated as WebService.

4.What is file extension of Webservices ?

ASMX is extension for Webservices.

5)Which property of the ServiceBase class can be used to specify whether a service can be paused and resumed?

The Pause And Continue property provides such type of service.

6.What is WSDL?

Web Service Description Language (WSDL)is a W3C specification which defines XML grammar for describing Web Services.XML grammar describes details such as:- Where we can find the Web Service (its URI)? √ What are the methods and properties that service supports? √ Data type support. √ Supported protocols In short its a bible of what the webservice can do.Clients can consume this WSDL and build proxy objects that clients use to communicate with the Web Services. 

7. Describe the services that UDDI provides to Web applications?

UDDI provides the following types of services to a Web application:
·      XML Schema for business descriptions - Includes information about the service publisher (contact name, address, and so on) and specifications on the Web service
·      Web registry of Web services - Includes business, service, and binding information for the Web service

8. Write the file extension for a Web service?

A Web service file extension is .asm file. For example, service1.asmx is a Web service file.

9. Which method is used to uninstall the Windows services?

The Uninstall() method is used to uninstall the Windows services.

10. What is the use of the mustUnderstand attribute in the Header element of a SOAP message?

The must Understand attribute indicates that a header entry is either required or optional for the recipient to process further.

11. Explain the WSDL?

WSDL is a short form for Web Services Description Language, which is used to describe a Web service in terms of the messages that it creates and accepts. The WSDL document is an XML file that contains the interface schema for the Web service. It identifies the methods that are used during the exchange between a Web service consumer and a Web service provider. The following are the elements contained in the WSDL document:
·      Types - Describe the variations of data types that are used to exchange messages between the user and the provider.
·      Message - Describes the actual message or method call.
·      portType - Describes the set of operations and each related message.
·      binding - Describes the protocol details.
·      service - Used to make groups a set of related ports together.

12. What advantage UDDI has over DISCO?

The UDDI directory has an advantage over a DISCO file, as it provides a single location where a client can find the Web services offered by different organizations.

13. How can you ensure that only authorized users access your Web service?

You should use the <authorization> element to ensure that only authorized users access your Web service. This element allows or denies access to your Web service according to their role.

14. What are the elements that should be contained in SOAP message?

·      Envelope – Translates the XML document to a SOAP message. It is the root element.
·      Header – Contains the header message. Contains the application specific information.
·      Body – Contains the call and response message.
Fault element – Used for communicating errors. If present, it appears as a child element of the body and can appear only once. 

15. How can you prevent your Web services from unauthorized access?

The following are the ways to prevent your Web service from unauthorized access:
·      Using encryption and message-based security.
·      Using authentication and access controls for the Web service.

16. Explain the concept of Web services in brief?

Web service is the way to publish application's function on web that can be accessible to the rest of the world.
·Web services are the components that can be used by other applications
·ASP.NET offers easy way to develop web services, just precede the functions with a special WebMethod ()> attribute in order them to work as Web Service.
·Web services are discovered using UDDI directory services.
·Web services are built on XML standard and use SOAP protocol that allows them to communicate across different platforms and programming languages.
·Web services easily manage to work across corporate firewalls as they use HTTP protocol which is firewall friendly.
·Web services platform elements are
SOAP (Simple Object Access Protocol)
UDDI (Universal Description, Discovery and Integration)
WSDL (Web Services Description Language)
·The web services are built on internet standards that are not platform or language specific.

17. What advantages have Web services over Component Object Model (COM) and Distributed Component Object Model (DCOM)?

The advantages of Web services over COM and DCOM are as follows:
·      Web services are simple to use and can be implemented on varied platforms.
·      Web services are loosely coupled; as a result, their interfaces and methods can be extended.
·      Web services do not carry any state information with them so that multiple requests can be processed simultaneously.

18. Mention the namespace that you must import in code to build a Web service?

System.Web.Services is the elementary namespace, which must be imported to develop code of a Web service.

19. What does the portType element of a WSDL document contain?

The portType element contains the operations exposed by the Web service, and the messages involved in the communication between the Web service and its consumers.

20. What is DISCO?

DISCO is a technology developed by Microsoft to publish and discover Web services. It discovers URLs of all XML Web services located on a Web server and creates a list of these Web services in a file called as a DISCO file.

21. Which two methods are used to discover the URL of Web services?

The two methods to discover the URL of Web services are Web service discovery tool (Disco.exe) and UDDI.

22. Which step is necessary to perform before a Web service can be consumed?

It is necessary to build a proxy class by using the wsdl.exe utility before a Web service can be consumed.

23. Which property of the WebMethod attribute allows you to maintain the state of objects across sessions in a Web method?

The WebMethod attribute's EnableSession property enables you to enable session state for a Web method.

24. Write the names of public properties defined in the WebService class?

There are many properties defined in the WebServices class:
·      Application - Obtains the application object for the current HTTP request
·      Context - Obtains the HttpContext object for the current request, which encapsulates all HTTP-specific context used by the HTTP server to process Web requests
·      Server - Obtains the HttpServerUtility object for the current request
·      Session - Obtains the HttpSessionState object for the current request
·      SoapVersion - Obtains the version of the SOAP protocol used to make the SOAP request to a Web service
·      User - Obtains the Server User Object. This property can be used to authenticate whether a user is authorized to execute the request.

25.What is SOAP?

SOAP, Simple Object Access Protocol is a communication protocol, a way to structure data before transmitting it, is based on XML standard. It is developed to allow communication between applications of different platforms and programming languages via internet.
It can use range of protocols such as HTTP, FTP, SMTP, Post office protocal 3(POP3) to carry documents.

26. What is the use of a .disco file?

A client application uses a .disco file to locate or discover the documents that contain the description of a Web service. The .disco file contains links to other resources, which describe essential features, such as capabilities of a Web service. The links contained in a .disco file can refer to other discovery documents or XSD schemas. The description about the services and capabilities of a Web service is written in Web services Description Language (WSDL). A .disco file can also contain the information about other XML Web services that reside on the same or a different Web server.

27. Mention the name of the directory where it is necessary to locate the proxy file to use a Web service?

The proxy file must be stored in the  web references directory. This directory is situated under the root directory of the application.

28. Does a Web service have state?

The Web services do not have any technique to maintain state. However, it can access ASP.NET objects, such as application and session if they extend from the WebService base class.

29. Which namespace must be included in a code that enables a XML Web service to write events in an event log file?

The System.Diagnostics is the namespace, which must be included in a code to enable a Web service for writing events in an event log file.

30. Which tool installs the DLL on your local computer and installs the Windows service in a transactional manner?

The Installutil.exe tool.

31.How do Web Services Communicate with applications across diverse platforms ?

using SOAP,XML,HTTP

32.structure of SOAP message ?Explain

SOAP Header,SOAP Body,SOAP Envelope

33.What do you understand by SOAP Encoding ?

The Serialization of types such as integers and Strings inside a Soap message is called Encoding

34.which Tool is used to generate proxy class in webservices ?

wsdl.exe

35.NameSpace used to perform the task of webservices ?

System.Web.Services

36.what are the advantages of distributed technology ?

         1. reusability within network
         2. better code maintanance
         3. sequring resoueces

37)Why Encrypt SOAP messages?

The main purpose of SOAP is to exchange messages over HTTP. For communication it uses XML. The messages exchanged if done in plain text can be potentially viewed by anyone across the internet. SOAP over HTTPS is secured. The entire HTTP message, including both the headers and the body of the HTTP message is encrypted using public asymmetric encryption algorithms. 

38)Define XML – RPC?

It is a protocol that makes use of XML messages to do Remote Procedure Calls.

39)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 .

 40)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.

41)Can you tell few benefits of web services?

The biggest advantage of web service is that is supported by wide variety of platforms. Moreover, in near future, web services may spread its boundary and enhance new methods that will provide ease to clients. The enhancement will not affect the clients, even if they offer old methods and parameters.

42)  Differentiate between .NET Web Services and .NET Remoting?

As far as protocol is concerned, .NET Web Service uses HTTP, while, .NET Remoting uses any protocol i.e. TCP/HTTP/SMTP. When it comes to performance, .NET Remoting is comparatively, faster than.NET Web Service. Also, as .NET Web Services are hosted via IIS, therefore, it is far more reliable than the .NET Remoting.

No comments:

Post a Comment