Which code segment should you use to call CreditService?

You develop an ASP.NET application that consumes a third-party XML Web service named CreditService. CreditService contains a Web method named ChargeCard. ChargeCard takes as input a credit card number, a billing address, and a monetary amount and returns a Boolean variable that indicates whether or not the card was charged.
Calls to ChargeCard take one minute to complete. You do not want users to have to wait while ChargeCard executes. You want users to be taken automatically to the next Web page of the application.

Which code segment should you use to call CreditService?

You develop an ASP.NET application that consumes a third-party XML Web service named CreditService. CreditService contains a Web method named ChargeCard. ChargeCard takes as input a credit card number, a billing address, and a monetary amount and returns a Boolean variable that indicates whether or not the card was charged.
Calls to ChargeCard take one minute to complete. You do not want users to have to wait while ChargeCard executes. You want users to be taken automatically to the next Web page of the application.

Which code segment should you use to call CreditService?

A.
CreditService.ChargeCard(ccNumb, billAddress,
amount);
Server.Transfer(“process.aspx”);

B.
CreditService.ChargeCard(ccNumb,
billAddress, amount);
Response.Redirect(“process.aspx”);

C.
CreditService.BeginChargeCard(ccNumb, billAddress,
amount, new AsyncCallback(CCResponse), null);
Server.Transfer(“process.aspx”);
private void CCResponse(IAsyncResult aRes) {
CreditService.EndChargeCard(aRes);
}

D.
IAsyncResult AsyncResult =
CreditService.BeginChargeCard(ccNumb, billAddress,
amount, null, null);
AsyncResult.AsyncWaitHandle.WaitOne();
CreditService.EndChargeCard(AsyncResult);
Server.Transfer(“process.aspx”);



Leave a Reply 0

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