SoapHeaderException Class
The SOAP representation of a server error.
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 ); } }
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);
}
}
System::Exception
System::SystemException
System.Web.Services.Protocols::SoapException
System.Web.Services.Protocols::SoapHeaderException
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Note: