SoapHeaderException 类

定义

服务器错误的 SOAP 表示形式。The SOAP representation of a server error.

public ref class SoapHeaderException : System::Web::Services::Protocols::SoapException
[System.Serializable]
public class SoapHeaderException : System.Web.Services.Protocols.SoapException
type SoapHeaderException = class
    inherit SoapException
Public Class SoapHeaderException
Inherits SoapException
继承
属性

示例

在下面的示例中, XML Web service 客户端调用MyWebMethod XML Web service 方法, 并传入类型MyHeader的 SOAP 标头, 并MustUnderstand将属性设置true为。In the following example, an XML Web service client calls the MyWebMethod XML Web service method, passing in a SOAP header of type MyHeader with the MustUnderstand property set to true. 如果DidUnderstand XML Web service 方法未将MyHeader SOAP标true头的属性设置为, 则会引发。SoapHeaderExceptionIf the XML Web service method does not set the DidUnderstand property of the MyHeader SOAP header to true, a SoapHeaderException is thrown.

int main()
{
   MyWebService^ ws = gcnew MyWebService;
   try
   {
      MyHeader^ customHeader = gcnew MyHeader;
      customHeader->MyValue = "Header Value for MyValue";
      customHeader->MustUnderstand = true;
      ws->myHeader = customHeader;
      int results = ws->MyWebMethod( 3, 5 );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception: {0}", e );
   }

}

using System;

public class Sample {
    
    public static void Main() {
        MyWebService ws = new MyWebService();

        try {
            MyHeader customHeader = new MyHeader();
            customHeader.MyValue = "Header Value for MyValue";
            customHeader.MustUnderstand = true;
            ws.myHeader = customHeader;
            
        int results = ws.MyWebMethod(3,5);
        }
        catch (Exception e) {
            Console.WriteLine ("Exception: {0}", e.ToString());
        }
    }
}

Public Class Sample
    
    Public Shared Sub Main()
        Dim ws As New MyWebService()

        Try
            Dim customHeader As New MyHeader1()

            customHeader.MyValue = "Header Value for MyValue"
            customHeader.MustUnderstand = True

            ws.myHeader = customHeader

        Dim results As Integer

            results = ws.MyWebMethod(3,5)
        Catch e As Exception
            Console.WriteLine("Exception: {0}", e.ToString())
        End Try
    End Sub
End Class

注解

当 XML Web service 客户端将 SOAP 标头MustUnderstand添加到属性设置为true的 XML Web service 方法调用中时, DidUnderstand XML Web service 方法必须将属性设置为true; 否则, SoapHeaderException将引发。When an XML Web service client adds a SOAP header to an XML Web service method call with the MustUnderstand property set to true, the XML Web service method must set the DidUnderstand property to true; otherwise, a SoapHeaderException is thrown.

不能根据的 SOAP 规范SoapHeaderException设置属性。DetailThe Detail property cannot be set according to the SOAP specification for a SoapHeaderException.

备注

使用 soap 1.1 规范作为服务协议的应用程序可以使用SoapHeaderException来访问 SOAP 错误。Applications that use the SOAP 1.1 specification as the service protocol can use the SoapHeaderException to access SOAP faults. 但是, 使用 soap 1.2 规范的应用程序必须使用SoapException来访问 SOAP 错误。However, applications that use the SOAP 1.2 specification must use the SoapException to access SOAP faults.

构造函数

SoapHeaderException()

初始化 SoapHeaderException 类的新实例。Initializes a new instance of the SoapHeaderException class.

SoapHeaderException(SerializationInfo, StreamingContext)

使用用于控制序列化的参数初始化 SoapHeaderException 类的新实例。Initializes a new instance of the SoapHeaderException class with parameters for controlling serialization.

SoapHeaderException(String, XmlQualifiedName)

初始化 SoapHeaderException 类的新实例。Initializes a new instance of the SoapHeaderException class.

SoapHeaderException(String, XmlQualifiedName, Exception)

初始化 SoapHeaderException 类的新实例。Initializes a new instance of the SoapHeaderException class.

SoapHeaderException(String, XmlQualifiedName, String)

初始化 SoapHeaderException 类的新实例。Initializes a new instance of the SoapHeaderException class.

SoapHeaderException(String, XmlQualifiedName, String, Exception)

初始化 SoapHeaderException 类的新实例。Initializes a new instance of the SoapHeaderException class.

SoapHeaderException(String, XmlQualifiedName, String, String, SoapFaultSubCode, Exception)

使用关联数据初始化 SoapHeaderException 类的新实例。Initializes a new instance of the SoapHeaderException class with the associated data.

SoapHeaderException(String, XmlQualifiedName, String, String, String, SoapFaultSubCode, Exception)

使用关联的数据初始化 SoapHeaderException 类的新实例。Initializes a new instance of the SoapHeaderException class with the associated data.

属性

Actor

获取导致异常的代码段。Gets the piece of code that caused the exception.

(继承自 SoapException)
Code

获取 SOAP 错误代码的类型。Gets the type of SOAP fault code.

(继承自 SoapException)
Data

获取键/值对的集合,这些键/值对提供有关该异常的其他用户定义信息。Gets a collection of key/value pairs that provide additional user-defined information about the exception.

(继承自 Exception)
Detail

获取表示应用程序特定的详细错误信息的 XmlNodeGets an XmlNode that represents the application-specific error information details.

(继承自 SoapException)
HelpLink

获取或设置指向与此异常关联的帮助文件链接。Gets or sets a link to the help file associated with this exception.

(继承自 Exception)
HResult

获取或设置 HRESULT(一个分配给特定异常的编码数字值)。Gets or sets HRESULT, a coded numerical value that is assigned to a specific exception.

(继承自 Exception)
InnerException

获取导致当前异常的 Exception 实例。Gets the Exception instance that caused the current exception.

(继承自 Exception)
Lang

获取与该异常关联的人类语言。Gets the human language associated with the exception.

(继承自 SoapException)
Message

获取描述当前异常的消息。Gets a message that describes the current exception.

(继承自 Exception)
Node

获取表示导致异常的代码段的 URI。Gets a URI that represents the piece of code that caused the exception.

(继承自 SoapException)
Role

获取一个 URI,它表示用于处理 SOAP 消息的 XML Web services 功能。Gets a URI that represents the XML Web service's function in processing the SOAP message.

(继承自 SoapException)
Source

获取或设置导致错误的应用程序或对象的名称。Gets or sets the name of the application or the object that causes the error.

(继承自 Exception)
StackTrace

获取调用堆栈上的即时框架字符串表示形式。Gets a string representation of the immediate frames on the call stack.

(继承自 Exception)
SubCode

获取 SOAP 错误中 subcode XML 元素包含的可选错误信息。Gets the optional error information contained in the subcode XML element of a SOAP fault.

(继承自 SoapException)
TargetSite

获取引发当前异常的方法。Gets the method that throws the current exception.

(继承自 Exception)

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetBaseException()

当在派生类中重写时,返回 Exception,它是一个或多个并发的异常的根本原因。When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions.

(继承自 Exception)
GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetObjectData(SerializationInfo, StreamingContext)

使用关于异常的信息设置 SerializationInfoSets the SerializationInfo with information about the exception.

(继承自 SoapException)
GetType()

获取当前实例的运行时类型。Gets the runtime type of the current instance.

(继承自 Exception)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

创建并返回当前异常的字符串表示形式。Creates and returns a string representation of the current exception.

(继承自 Exception)

事件

SerializeObjectState

当异常被序列化用来创建包含有关该异常的徐列出数据的异常状态对象时会出现该问题。Occurs when an exception is serialized to create an exception state object that contains serialized data about the exception.

(继承自 Exception)

适用于

另请参阅