This documentation is archived and is not being maintained.

SoapException::Code Property

Gets the type of SOAP fault code.

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

public:
property XmlQualifiedName^ Code {
	XmlQualifiedName^ get ();
}

Property Value

Type: System.Xml::XmlQualifiedName
An XmlQualifiedName that specifies the SOAP fault code that occurred.

The Code property can only be set when creating a new instance of the SoapException class.

The SoapException class is for use by XML Web service clients that call XML Web service methods over SOAP. ASP.NET handles whether the client that calls uses SOAP. This is when an exception occurs in an XML Web service. If the client uses SOAP, ASP.NET wraps the specific exception into a SoapException and sets the Actor and Code properties.

The set of available codes, known as SOAP Fault Codes for SOAP protocol version 1.1, are the following:

Item

Description

VersionMismatchFaultCode

An invalid namespace for a SOAP envelope was found.

MustUnderstandFaultCode

Not all SOAP elements require processing. However, if a SOAP element is marked with the MustUnderstand attribute with a value of 1, it is required. Failure to process the element generates this exception.

ClientFaultCode

A client call was not formatted correctly or did not contain the appropriate information. For example, the client call might not have the proper authentication or payment information. It is generally an indication that the message must be changed before it is resent.

ServerFaultCode

An error occurred during the processing of a client call on the server, however, the problem is not due to the message contents. For example, an upstream server might not respond to a request due to network problems. Typically, with this type of exception, the client call might succeed later. If an XML Web service throws an exception, other than SoapException and the client calls using SOAP, ASP.NET converts the exception to a SoapException, setting the Code property to ServerFaultCode and throws it back to the client.

The following Web Form example calls the Math Web Service method, which throws an exception if a division by zero occurs. Once the exception is thrown, the Web Form catches the exception and outputs the exception details, including the Actor and Code properties into a HtmlTable control.

No code example is currently available or this language may not be supported.

In order for the preceding Web Form to use the following Math XML Web service example, a namespace of MyMath was specified during the creation of the proxy class.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: