SoapException.Detail 속성

정의

애플리케이션별 오류 세부 정보를 나타내는 XmlNode를 가져옵니다.

public:
 property System::Xml::XmlNode ^ Detail { System::Xml::XmlNode ^ get(); };
public System.Xml.XmlNode Detail { get; }
member this.Detail : System.Xml.XmlNode
Public ReadOnly Property Detail As XmlNode

속성 값

애플리케이션별 오류 정보입니다.

예제

다음 예제에서는 을 SoapExceptionthrow합니다. 여기서 XML 웹 서비스 메서드는 Detail 속성을 설정합니다.

<%@ 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. 
    [WebMethod]
    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, 
            SoapException.DetailElementName.Name, 
            SoapException.DetailElementName.Namespace);


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

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

        // Append the two child elements to the detail node.
        node.AppendChild(details);
        node.AppendChild(details2);

            
        //Throw the exception.    
        SoapException se = new SoapException("Fault occurred", 
            SoapException.ClientFaultCode,Context.Request.Url.AbsoluteUri,node);

        throw se;
        return;    
    }
}
<%@ WebService Language="VB" class="ThrowSoapException"%>

Imports System
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
Imports System.Xml

Public Class ThrowSoapException
    Inherits WebService
    
    ' This XML Web service method generates a SOAP client fault code. 
    <WebMethod()> _
    Public Sub myThrow()
        
        ' Build the detail element of the SOAP fault.
        Dim doc As New System.Xml.XmlDocument()
        Dim node As System.Xml.XmlNode = doc.CreateNode(XmlNodeType.Element, _
            SoapException.DetailElementName.Name, _
            SoapException.DetailElementName.Namespace)
 
        ' Build specific details for the SoapException.
        ' Add first child of detail XML element.
        Dim details As System.Xml.XmlNode = doc.CreateNode(XmlNodeType.Element, _
            "mySpecialInfo1", "http://tempuri.org/")

        ' Add second child of detail XML element with an attribute.
        Dim details2 As System.Xml.XmlNode = doc.CreateNode(XmlNodeType.Element, _
            "mySpecialInfo2", "http://tempuri.org/")
        Dim attr As XmlAttribute = doc.CreateAttribute("t", "attrName", _
            "http://tempuri.org/")
        attr.Value = "attrValue"
        details2.Attributes.Append(attr)

        ' Append the two child elements to the detail node.
        node.AppendChild(details)
        node.AppendChild(details2)
                
        ' Throw the exception.    
        Dim se As New SoapException("Fault occurred", SoapException.ClientFaultCode, _
                                    Context.Request.Url.AbsoluteUri, node)
        Throw se
        Return
    End Sub
End Class

설명

Detail 값을 허용하는 클래스 생성자 중 하나를 사용하여 속성을 설정할 수 있습니다Detail.

Detail 속성을 관련 애플리케이션별 오류 세부 정보를 제공 하는 데 사용 됩니다는 Body SOAP 요청의 요소입니다. SOAP 사양에 따라 SOAP 요청 Detail 의 요소로 인해 Body 클라이언트 요청을 처리할 수 없으므로 오류가 발생하면 속성을 설정해야 합니다. SOAP 요청의 헤더 항목에서 오류가 발생하면 오류 세부 정보가 SOAP 헤더에 반환되도록 을 throw SoapHeaderException해야 합니다. 요소 DetailBody 처리로 인해 오류가 발생하지 않으면 속성을 설정하지 않아야 합니다.

속성에 대한 를 XmlNode 빌드할 Detail 때 및 NameNamespace 속성을 DetailElementName 사용하여 SOAP 사양과 일관성을 유지할 수 있습니다.

detail 요소의 모든 직속 자식 요소를 세부 정보 항목이라고 하며 각 세부 정보 항목은 detail 요소 내에서 독립적인 요소로 인코딩됩니다.

적용 대상

추가 정보