SoapHeader.MustUnderstand 속성

정의

SoapHeader를 인식해야 하는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool MustUnderstand { bool get(); void set(bool value); };
public bool MustUnderstand { get; set; }
member this.MustUnderstand : bool with get, set
Public Property MustUnderstand As Boolean

속성 값

Boolean

XML Web services가 SoapHeader를 올바르게 해석하고 처리해야 하면 true이고, 그렇지 않으면 false입니다. 기본값은 false입니다.

예제

형식의 사용자 지정 SOAP 헤더를 정의 하는 다음 XML 웹 서비스 클라이언트 MyHeader를 설정 합니다 MustUnderstand 속성을 true, 호출 및를 MyWebMethod XML 웹 서비스 메서드. XML 웹 서비스 메서드를 설정 하지 않는 경우는 DidUnderstand 의 속성을 MyHeader SOAP 헤더를 true, SoapHeaderException throw 됩니다.

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 웹 서비스 클라이언트를 사용 하 여 XML 웹 서비스 메서드 호출에 SOAP 헤더를 추가 하는 경우는 MustUnderstand 속성으로 설정 true, XML 웹 서비스 메서드에 설정 해야 합니다는 DidUnderstand 속성을 true이 고, 그렇지 않으면를 SoapHeaderException 다시 throw 됩니다 ASP.NET에서 XML 웹 서비스 클라이언트입니다.

하지만 모두를 EncodedMustUnderstandMustUnderstand 속성의 값을 설정할 수는 mustUnderstand SOAP 헤더 내에서 특성을 MustUnderstand 속성을 사용 하면 부울 값을 사용 하 여 특성을 설정할 수 있습니다.

클라이언트에 SOAP 헤더를 추가하는 방법에 대한 자세한 내용은 SOAP 헤더 사용을 참조하세요.

적용 대상

추가 정보