Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

Generated Proxy Classes Failed Callback Function

Called to process error information after a Web service method call has failed.

note

The failed callback function can have any name.

Syntax

FailedCallback(error, userContext, methodName)
{
    // Code here to handle the failure.
}

Parameter

Definition

error

A WebServiceError object.

userContext

The context information that was passed when the Web service method was invoked. If the context information is not passed, the defaultUserContext value is used, if defined; otherwise null is passed to the callback function. The userContext parameter provides additional information to use when you process the returned data.

methodName

The Web service method that was invoked. The methodName parameter provides additional information to use when you process the returned data. For example, methodName enables you to determine which method call failed.

Remarks

The failed callback function is a JavaScript function that you can provide to process the error after a Web service request fails. The failure can be caused by a run-time error or a time out, or if the Web service ends the request prematurely.

You can assign the callback function to the generated proxy class or its instances by using the defaultFailedCallback property. Alternatively, you can pass the reference to the callback function when you call a Web service method. This overrides the default value.

Example

The following example shows how to define a failed callback function.

javascript

// Callback function invoked when a call to 
// the Web service methods fails.
function FailedCallback(error, userContext, methodName) 
{
    if(error !== null) 
    {
        displayResult.innerHTML = "An error occurred: " + 
            error.get_message();
    }
}