SoapHeaderException Class
Assembly: System.Web.Services (in system.web.services.dll)
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.
Note: |
|---|
|
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.
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 ); } }
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.Exception
System.SystemException
System.Web.Services.Protocols.SoapException
System.Web.Services.Protocols.SoapHeaderException
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.
Note: