errorDetail Object

This topic documents a feature of Binary Behaviors, which are obsolete as of Internet Explorer 10.

This object is exposed by the result object if an error is encountered from an invocation of the callService method. The properties of errorDetail provide detailed information and diagnostics on the error.

Members Table

The following table lists the members exposed by the errorDetail object.

Property Description
code A machine-readable error code that corresponds to a specific invocation of the callService method.
raw Exposes the raw SOAP data packet returned by the Web Service after invoking the callService method.
string A human-readable error message that corresponds to a specific invocation of the callService method.

Remarks

This object is created at runtime by the WebService behavior each time the callService method is invoked. The errorDetail object is defined if the error property of the result object is true.

Example

The following sample code shows how the properties of errorDetail can be obtained when a method call is unsuccessful.

<SCRIPT language="JavaScript">
var iCallID;

function init()
{
    service.useService("/services/math.asmx?WSDL","MyMath");
    iCallID = service.MyMath.callService("add",5,6);
}

function onWSresult()
{  
    if((event.result.error)&&(iCallID==event.result.id))  
    {    
        var xfaultcode   = event.result.errorDetail.code;
        var xfaultstring = event.result.errorDetail.string;    
        var xfaultsoap   = event.result.errorDetail.raw;
        document.writeln("ERROR. Method call failed!");
        document.writeln("Call ID:" + iCallID);
        document.writeln("Fault Code:" + xfaultcode);
        document.writeln("Fault String:" + xfaultstring);
        document.writeln("SOAP Data:" + xfaultsoap);
    }
    else if(event.result.error == false)
    {
        document.writeln("Result received without errors!");
    }
}
</script>
<body onload="init()">
<div id="service" style="behavior:url(webservice.htc)" onresult="onWSresult()">
</div>
</body>

Applies To

result

See Also

callService, useService, Using the WebService Behavior, About the WebService Behavior