Compartilhar via


Sys.Net.WebServiceError Class

Represents the object type that is returned to the browser when a Web service raises an error.

Namespace: Sys.Net

Inherits: None

Members

Name

Description

Sys.Net.WebServiceError Constructor

Initializes a new instance of the Sys.Net.WebServiceError class when implemented in a derived class.

Sys.Net.WebServiceError.errorObject Property

Gets the raw error information.

Sys.Net.WebServiceError.exceptionType Property

Gets the exception type of the error.

Sys.Net.WebServiceError.message Property

Gets the error message returned by the error.

Sys.Net.WebServiceError.statusCode Property

Gets the status code for the HTTP response.

Sys.Net.WebServiceError.stackTrace Property

Gets the stack trace that is returned by the server.

Sys.Net.WebServiceError.timedOut Property

Gets a value that indicates whether the Web service failed because it timed out.

Remarks

The WebServiceError is the type of the object that is returned to the failed callback function.

Example

Description

The following example shows how a failed callback function accesses the WebServiceError object. For more information, see Calling Web Services from Client Script in ASP.NET AJAX.

Code

// This is the failed callback function.
function OnFailed(error)
{
    var stackTrace = error.get_stackTrace();

    var message = error.get_message();

    var statusCode = error.get_statusCode();

    var exceptionType = error.get_exceptionType();

    var timedout = error.get_timedOut();

    // Display the error.    
    var RsltElem = 
        document.getElementById("Results");
    RsltElem.innerHTML = 
        "Stack Trace: " +  stackTrace + "<br/>" +
        "Service Error: " + message + "<br/>" +
        "Status Code: " + statusCode + "<br/>" +
        "Exception Type: " + exceptionType + "<br/>" +
        "Timedout: " + timedout;
}

See Also

Reference

Sys.Net.XMLHttpExecutor Class

Sys.Net.WebRequestManager Class

Other Resources

Calling Web Services from Client Script in ASP.NET AJAX