You work as the Microsoft.NET developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003. The development and deployment of Extensible Markup Language (XML) Web Services forms part of your responsibilities at Domain.com.
The following exhibit illustrates a class definition in a Web service project:
public class MarketService
{
public Point ObtainMarket(string mobilePhoneNumber)
{
throw new SoapException(“Not implemented”, New XmlQualifiedName(“error”));
}
}
You have received instruction to configure the class in such a way so as to allow SOAP clients to invoke the ObtainMarket method.
What should you do?
A.
The class should be derived from WebService.
B.
The class should be derived from SoapHttpClientProtocol.
C.
The WebMethod attribute should be applied to the method.
D.
The WebService attribute should be applied to the class.
Explanation:
The Webmethod attribute applied to the method will indicate that a public method should be exposed as a Web method of a Web service. Thus you should apply the WebMethod attribute to the method.
Incorrect answers:
A: Since the WebService base class is optional, and it provides direct access to the Session and Application instances, you should not derive the class from WebService.
B: You should derive a proxy class from this class in a SOAP client application. This will allow the client application to make SOAP calls via the proxy class to the Web service. Thus you should not derive the class from SoapHttpClientProtocol.
D: The WebService attribute will allow you to specify a namespace and description for the Web service; you should not apply the WebService attribute to the class.