Which code segment should you use?

You are creating a Web service to expose the public methods on a class.
Two overloaded methods are defined in the class as follows:

public Customer GetCustomer(string custId)
public Customer GetCustomer(string name, string postalCode)

You need to expose both methods on the Web service.

Which code segment should you use?

You are creating a Web service to expose the public methods on a class.
Two overloaded methods are defined in the class as follows:

public Customer GetCustomer(string custId)
public Customer GetCustomer(string name, string postalCode)

You need to expose both methods on the Web service.

Which code segment should you use?

A.
[WebMethod]
[SoapDocumentMethod(Action="GetCustomerById")]
public Customer GetCustomer(string custId)
{ … }
[WebMethod]
[SoapDocumentMethod(Action="GetCustomerByName")]
public Customer GetCustomer(string name, string postalCode)
{ … }

B.
[WebMethod(Description="GetCustomerById")]
public Customer GetCustomer(string custId)
{ … }
[WebMethod(Description="GetCustomerByName")]
public Customer GetCustomer(string name, string postalCode)
{ … }

C.
[WebMethod(MessageName="GetCustomerById")]
public Customer GetCustomer(string custId)
{ … }
[WebMethod(MessageName="GetCustomerByName")]
public Customer GetCustomer(string name, string postalCode)
{ … }

D.
[WebMethod]
[SoapDocumentMethod(RequestElementName="GetCustomerById")]
public Customer GetCustomer(string custId)
{ … }
[WebMethod]
[SoapDocumentMethod(RequestElementName="GetCustomerByName")]
public Customer GetCustomer(string name, string postalCode)
{ … }



Leave a Reply 0

Your email address will not be published. Required fields are marked *