SoapHeaderException Class
The exception that is thrown when an XML Web service method is called over SOAP and an exception occurs during processing of the SOAP header.
For a list of all members of this type, see SoapHeaderException Members.
System.Object
System.Exception
System.SystemException
System.Web.Services.Protocols.SoapException
System.Web.Services.Protocols.SoapHeaderException
[Visual Basic] Public Class SoapHeaderException Inherits SoapException [C#] public class SoapHeaderException : SoapException [C++] public __gc class SoapHeaderException : public SoapException [JScript] public class SoapHeaderException extends SoapException
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
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.
The Detail property can not be set per the SOAP specificaion for a SoapHeaderException.
Example
[Visual Basic, C#, C++] The following XML Web service client calls the MyWebMethod XML Web service method passing in a SOAP header of Type MyHeader setting the MustUnderstand property to true. If the XML Web service method doesn't set the DidUnderstand property of the MyHeader SOAP header to true, a SoapHeaderException is thrown.
[Visual Basic] 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] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Web.Services.Protocols
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
Assembly: System.Web.Services (in System.Web.Services.dll)
See Also
SoapHeaderException Members | System.Web.Services.Protocols Namespace | MustUnderstand | DidUnderstand | SoapHeader | SoapException