Generated Proxy Classes defaultFailedCallback Property

Gets or sets the default failed callback function for the generated proxy class and its instances. This property exists at run time after the proxy class has been generated by the server.

Note

To get or set property values for client API properties, you must call property accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a value for a property such as cancel, you call the get_cancel or set_cancel methods.

// Syntax for a static proxy class.
var failedCallback = 
  MyNameSpace.MyServiceProxy.get_defaultFailedCallback(); 
MyNameSpace.MyServiceProxy.set_defaultFailedCallback(handler);

// Syntax for a proxy instance.
var failedCallback = myServiceProxy.get_defaultFailedCallback(); 
myServiceProxy.set_defaultFailedCallback(handler); 

Parameters

Parameter

Description

handler

The failed callback function.

Return Value

The failed callback function, if one has been set; otherwise, null.

Remarks

The failed callback function is invoked when a call to a Web service method fails.

The failed callback function can be passed as a parameter during any call to a Web service method. If you pass a failed callback function when you call a Web service method, the passed function overrides the function that is set by using the defaultFailedCallback property.

Example

The following example shows how to set and get the defaultFailedCallback property for the generated proxy class and for a proxy instance.

// This function sets and gets the default failed 
// callback function for the Web service generated 
// proxy class.
function AssignFailedCallback() 
{
    // Set the default callback.
    Samples.AspNet.UsingProxyClass.set_defaultFailedCallback(FailedCallback);

    // Get the default callback.
    var callback = 
        Samples.AspNet.UsingProxyClass.get_defaultFailedCallback();

    // Display the callback.
    DisplayMessage(callback);
}
// This function sets and gets the default failed 
// callback function for an instance of the Web service 
// generated proxy class.
function AssignInstanceFailedCallback() 
{ 
   // Create an instance of the proxy class.
    var proxyInstance = 
        new Samples.AspNet.UsingProxyClass();

    // Set the default callback.
    proxyInstance.set_defaultFailedCallback(FailedCallback);

    // Get the default callback.
    var callback = proxyInstance.get_defaultFailedCallback();

    // Display the callback.
    DisplayMessage(callback);
}

See Also

Reference

Generated Proxy Classes Succeeded Callback Function

Generated Proxy Classes Failed Callback Function

Concepts

Sys.Net.WebServiceProxy Class