次の方法で共有


SoapHeaderException クラス

XML Web サービス メソッドが SOAP 経由で呼び出され、SOAP ヘッダーの処理中に例外が発生したときにスローされる例外。

この型のすべてのメンバの一覧については、SoapHeaderException メンバ を参照してください。

System.Object
   System.Exception
      System.SystemException
         System.Web.Services.Protocols.SoapException
            System.Web.Services.Protocols.SoapHeaderException

Public Class SoapHeaderException
   Inherits SoapException
[C#]
public class SoapHeaderException : SoapException
[C++]
public __gc class SoapHeaderException : public SoapException
[JScript]
public class SoapHeaderException extends SoapException

スレッドセーフ

この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。

解説

XML Web サービス クライアントが MustUnderstand プロパティを true に設定して XML Web サービス メソッドの呼び出しに SOAP ヘッダーを追加する場合、XML Web サービス メソッドは DidUnderstand プロパティを true に設定する必要があります。それ以外の場合は、 SoapHeaderException がスローされます。

Detail プロパティは、 SoapHeaderException の SOAP の仕様ごとに設定できません。

使用例

[Visual Basic, C#, C++] MustUnderstand プロパティを true に設定して、 Type MyHeader の SOAP ヘッダー内に渡す MyWebMethod XML Web サービス メソッドを呼び出す XML Web サービス クライアントを次に示します。XML Web サービス メソッドが MyHeader SOAP ヘッダーの DidUnderstand プロパティを true に設定しない場合は、 SoapHeaderException がスローされます。

 
Imports System

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


[C#] 
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());
        }
    }
}


[C++] 

int main() {
   MyWebService* ws = new MyWebService();

   try {
      MyHeader* customHeader = new MyHeader();
      customHeader->MyValue = S"Header Value for MyValue";
      customHeader->MustUnderstand = true;
      ws->myHeader = customHeader;

      int results = ws->MyWebMethod(3,5);
   }
   catch (Exception* e) {
      Console::WriteLine (S"Exception: {0}", e);
   }
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

名前空間: System.Web.Services.Protocols

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

アセンブリ: System.Web.Services (System.Web.Services.dll 内)

参照

SoapHeaderException メンバ | System.Web.Services.Protocols 名前空間 | MustUnderstand | DidUnderstand | SoapHeader | SoapException