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. Domain.com operates as a credit bureau.
The development of Extensible Markup Language (XML) Web Services forms part of your responsibilities at Domain.com. You are currently developing an Extensible Markup Language (XML) Web Service that will allow legitimate third parties to access credit scores, pull credit records, and update credit information for customers. You need to implement a Web method named ObtainCreditScore. ObtainCreditScore should accept a String parameter and return an integer. You need to make use of Remote Procedure Call (RPC) style for this Web method; you also need to make use of the Document style for all Web methods that will be implemented. To this end you need to make use of the appropriate code segment for the Web service.
What should you do?
A.
[WebService(Namespace=”urn: Certkiller “)]
[SoapRpcService]
public class CreditService
{
[WebMethod]
public int ObtainCreditScore(string customerIdentifier) {
return 0;
}
}
B.
[WebService(Namespace=”urn: Certkiller “)]
public class WebService
{
[SoapRpcMethod]
public int ObtainCreditScore(string customerIdentifier) {
return 0;
}
}
C.
[WebService(Namespace=”urn: Certkiller “)]
public class CreditService
{
[WebMethod]
[SoapRpcMethod]
public int ObtainCreditScore(string customerIdentifier) {
return 0;
}
}
D.
[SoapRpcService]
public class WebService
{
[WebMethod]
[SoapRpcMethod]
public int ObtainCreditScore(string customerIdentifier) {
return 0;
}
}
Explanation:
the WebMethod and SoapRpcMethod attributes should be asses to the ObtainCreditScore Web method. The WebMethod attribute in essence makes the method accessible by Web service clients. And the SoapRpcMethods instructs the Web Services Description Language (WSDL) generator to set the style attribute to Rpc for the ObtainCreditScore operation element.
Incorrect answers:
A, B: You must not apply the SoapRpcService attribute to the class because it will instruct the WSDL generator to set the style attribute to rpc instead of document style.
D: The WebMethod attribute and NOT the SoapRpcService attribute should be applied to the ObtainCreditScore method to make the method accessible to the Web service clients.