function btnThrowException_onclick() {
ComplexWebService.BadMethod(
0,
true,
onBadMethodComplete,
onBadMethodTimeout,
onBadMethodError,
onBadMethodAborted,
"btnThrowException_onclick",
10000
);
}
function onBadMethodError(result, response, userContext)
{
var errorString = "Test '" userContext "' failed!";
if (result == null) {
errorString = " Status code='" response.get_statusCode() "'";
}
else {
errorString =
" Message='" result.get_message()
"'\r\nstackTrace = " result.get_stackTrace();
}
alert(errorString);
}
用户取消,与正常完成类似,不过在发出请求后立刻使用request.abort()取消了操作:
function btnCanceld_onclick() {
var request = ComplexWebService.BadMethod(
2000,
false,
onBadMethodComplete,
onBadMethodTimeout,
onBadMethodError,
onBadMethodAborted,
"btnCanceld_onclick",
10000
);
request.abort();
}
function onBadMethodAborted(request, userContext) {
var errorString = "The call to '" userContext "' failed, request is aborted!";
alert(errorString);
}
该示例程序可以在此下载:http://www.cnblogs.com/Files/dflying/ControlTheWebService.zip
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




