PrepAway - Latest Free Exam Questions & Answers

Which code segment should you use?

You are creating an XML Web service named AccountInformation for a community bank. AccountInformation exposes a Web method named GetAccountBalance that returns the account balance as a string. You must limit access to GetAccountBalance to users who have credentials stored in your Microsoft SQL Server database.

You need to design GetAccountBalance to receive encrypted user credentials by using two custom fields named Username and Password in the SOAP header. To accomplish this goal, you must write the code for GetAccountBalance.

Which code segment should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
public class AuthenticateUser : SoapHeader {
public string Username;
public string Password;
}
// In the AccountInformation class add this code:
public AuthenticateUser authenticateUserHeader;
[WebMethod, SoapHeader(“authenticateUserHeader”)]
public string GetAccountBalance() {
if (authenticateUserHeader == null)
return “Please supply credentials.”;
else
// Code to authenticate the user and return
// the account balance goes here.
}

B.
public class AuthenticateUser {
public string Username;
public string Password;
}
// In the AccountInformation class add this code:
public AuthenticateUser authenticateUserHeader;
[WebMethod, SoapHeader(“authenticateUserHeader”)]
public string GetAccountBalance() {
if (authenticateUserHeader == null)
return “Please supply credentials.”;
else
// Code to authenticate the user and return
// the account balance goes here.
}

C.
public class AuthenticateUser : SoapHeader {
public string Username;
public string Password;
}
// In the AccountInformation class add this code:
public AuthenticateUser authenticateUserHeader;
[WebMethod]
public string GetAccountBalance() {
if (authenticateUserHeader == null)
return “Please supply credentials.”;
else
// Code to authenticate the user and return
// the account balance goes here.
}

D.
public class AuthenticateUser {
public string Username;
public string Password;
}
// In the AccountInformation class add this code:
public AuthenticateUser authenticateUserHeader;
[WebMethod, SoapHeader(“authenticateUserHeader”)]
public string GetAccountBalance() {
if (authenticateUserHeader == null)
return “Please supply credentials.”;
else
// Code to authenticate the user and return
// the account balance goes here.
}


Leave a Reply