This documentation is archived and is not being maintained.

SoapException.Detail Property

Gets an XmlNode that represents the application-specific error information details.

Namespace:  System.Web.Services.Protocols
Assembly:  System.Web.Services (in System.Web.Services.dll)

public XmlNode Detail { get; }

Property Value

Type: System.Xml.XmlNode
The application-specific error information.

The Detail property can be set using one of the class constructors that accepts a Detail value.

The Detail property is used to supply application-specific error details related to the Body element of the SOAP request. According to the SOAP specification, if an error occurs because the client request cannot be processed due to the Body element of the SOAP request, the Detail property must be set. If an error occurs in the header entries of the SOAP request, you must throw a SoapHeaderException, so that the error details are returned in the SOAP header. If the error does not occur, due to the processing of the Body element, then the Detail property must not be set.

In building an XmlNode for the Detail property, the Name and Namespace properties of DetailElementName can be used to ensure consistency with the SOAP specification.

All immediate child elements of the detail element are called detail entries and each detail entry is encoded as an independent element within the detail element.

The following example throws a SoapException, where the XML Web service method sets the Detail property.

<%@ WebService Language="C#" class="ThrowSoapException"%>

using System;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
using System.Xml;

public class ThrowSoapException : WebService 
    // This XML Web service method generates a SOAP client fault code. 
    public void myThrow(){

        // Build the detail element of the SOAP fault.
        System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
        System.Xml.XmlNode node = doc.CreateNode(XmlNodeType.Element, 

        // Build specific details for the SoapException. 
        // Add first child of detail XML element.
        System.Xml.XmlNode details = doc.CreateNode(XmlNodeType.Element, 
            "mySpecialInfo1", "");
        System.Xml.XmlNode detailsChild = doc.CreateNode(XmlNodeType.Element, 
            "childOfSpecialInfo", "");

        // Add second child of detail XML element with an attribute.
        System.Xml.XmlNode details2 = doc.CreateNode(XmlNodeType.Element, 
            "mySpecialInfo2", "");
        XmlAttribute attr = doc.CreateAttribute("t", "attrName", 
        attr.Value = "attrValue";

        // Append the two child elements to the detail node.

        //Throw the exception.    
        SoapException se = new SoapException("Fault occurred", 

        throw se;
        return;    }

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0