Sams Teach Yourself ASP.NET in 21 Days, Second Edition By Chris Payne
Table of Contents
Appendix A. Answers to Quiz Questions
Quiz
1:
What is a proxy class?
A1:
A class that provides methods for a client application to access a Web Service's methods. You use the proxy class because it provides built-in support for sending and receiving XML messages.
2:
Write an example of a typical use of the disco.exe tool.
A1:
disco http://localhost/tyaspnet21days/services.disco
3:
Write an example of a typical use of the wsdl.exe tool.
True or false: Discovery must be performed before proxy generation.
A1:
False. Discovery isn't a necessary step.
5:
Which two namespaces are required for using SOAP headers to access services?
A1:
System.Web.Services and System.Web.Services.Protocols.
6:
Create a simple SOAP header class. What do you do with this class in a Web method? On the client?
A1:
1: Public Class SOAPHeader : Inherits SoapHeader 2: Public Username as string 3: Public Password as string 4: End Class
You need to create an instance of this class in any class that you want to expose as a service. The Web methods that use this class must specify the attribute <SoapHeader()>.
The client must create an instance of the class as well (through the proxy), and set its properties.
Exercise
Q1:
Generate a proxy class for the ConvertUnits service you created in exercise 2 on Day 16. Build an interface to allow users to enter values.