Export (0) Print
Expand All

SoapHeaderException Class

The SOAP representation of a server error.

Namespace: System.Web.Services.Protocols
Assembly: System.Web.Services (in system.web.services.dll)

[SerializableAttribute] 
public class SoapHeaderException : SoapException
/** @attribute SerializableAttribute() */ 
public class SoapHeaderException extends SoapException
SerializableAttribute 
public class SoapHeaderException extends SoapException
Not applicable.

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 cannot be set according to the SOAP specification for a SoapHeaderException.

NoteNote:

Applications that use the SOAP 1.1 specification as the service protocol can use the SoapHeaderException to access SOAP faults. However, applications that use the SOAP 1.2 specification must use the SoapException to access SOAP faults.

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. If the XML Web service method does not set the DidUnderstand property of the MyHeader SOAP header to true, a SoapHeaderException is thrown.

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());
        }
    }
}


import System.*;

public class Sample
{
    public static void main(String[] args)
    {
        MyWebService ws = new MyWebService();
        try {
            MyHeader customHeader = new MyHeader();
            customHeader.myValue = "Header Value for MyValue";
            customHeader.set_MustUnderstand(true);
            ws.myHeader = customHeader;
            int results = ws.MyWebMethod(3, 5);
        }
        catch (System.Exception e) {
            Console.WriteLine("Exception: {0}", e.ToString());
        }
    } //main
} //Sample


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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft