This documentation is archived and is not being maintained.
SoapHeaderException Constructor
.NET Framework 1.1
Overload List
Initializes a new instance of the SoapHeaderException class.
Supported by the .NET Compact Framework.
[Visual Basic] Public Sub New(String, XmlQualifiedName)
[C#] public SoapHeaderException(string, XmlQualifiedName);
[C++] public: SoapHeaderException(String*, XmlQualifiedName*);
[JScript] public function SoapHeaderException(String, XmlQualifiedName);
Initializes a new instance of the SoapHeaderException class.
[Visual Basic] Public Sub New(String, XmlQualifiedName, Exception)
[C#] public SoapHeaderException(string, XmlQualifiedName, Exception);
[C++] public: SoapHeaderException(String*, XmlQualifiedName*, Exception*);
[JScript] public function SoapHeaderException(String, XmlQualifiedName, Exception);
Initializes a new instance of the SoapHeaderException class.
Supported by the .NET Compact Framework.
[Visual Basic] Public Sub New(String, XmlQualifiedName, String)
[C#] public SoapHeaderException(string, XmlQualifiedName, string);
[C++] public: SoapHeaderException(String*, XmlQualifiedName*, String*);
[JScript] public function SoapHeaderException(String, XmlQualifiedName, String);
Initializes a new instance of the SoapHeaderException class.
[Visual Basic] Public Sub New(String, XmlQualifiedName, String, Exception)
[C#] public SoapHeaderException(string, XmlQualifiedName, string, Exception);
[C++] public: SoapHeaderException(String*, XmlQualifiedName*, String*, Exception*);
[JScript] public function SoapHeaderException(String, XmlQualifiedName, String, Exception);
Example
[Visual Basic, C#] Note This example shows how to use one of the overloaded versions of the SoapHeaderException constructor. For other examples that might be available, see the individual overload topics.
[Visual Basic] <%@ WebService Language="VB" Class="MathSvc" %> Imports System Imports System.Web.Services Imports System.Web.Services.Protocols Public Class MySoapHeader Inherits SoapHeader Public number As Integer End Class 'MySoapHeader Public Class MathSvc Inherits WebService Public mySoapHeader As MySoapHeader <WebMethod(), SoapHeaderAttribute("mySoapHeader", _ Direction := SoapHeaderDirection.In)> _ Public Function Add(xValue As Single, yValue As Single) As Single ' Process the header from the client. Try Dim j As Integer = 100 / mySoapHeader.number Catch e As Exception ' Throw a SoapHeaderException if an exception is caught during ' header processing. Throw New SoapHeaderException( _ "An Exception was thrown during the processing of header", _ SoapException.ClientFaultCode, _ "http://localhost/MathSvc_SoapHeaderException4.vb.asmx/Add", e) End Try Return xValue + yValue End Function 'Add End Class 'MathSvc [C#] <%@ WebService Language="C#" Class="MathSvc" %> using System; using System.Web.Services; using System.Web.Services.Protocols; public class MySoapHeader : SoapHeader { public int number; } public class MathSvc : WebService { public MySoapHeader mySoapHeader; [WebMethod] [SoapHeaderAttribute("mySoapHeader", Direction=SoapHeaderDirection.In)] public float Add(float xValue, float yValue) { // Process the header from the client. try { int j = 100/mySoapHeader.number; } catch(Exception e) { // Throw a SoapHeaderException if an exception is caught during // header processing. throw new SoapHeaderException( "An Exception was thrown during the processing of header", SoapException.ClientFaultCode, "http://localhost/MathSvc_SoapHeaderException4.cs.asmx/Add", e); } return(xValue + yValue); } }
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
See Also
SoapHeaderException Class | SoapHeaderException Members | System.Web.Services.Protocols Namespace
Show: