Freigeben über


SoapHeaderException-Konstruktor (String, XmlQualifiedName, String, Exception)

Initialisiert eine neue Instanz der SoapHeaderException-Klasse.

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

Syntax

'Declaration
Public Sub New ( _
    message As String, _
    code As XmlQualifiedName, _
    actor As String, _
    innerException As Exception _
)
'Usage
Dim message As String
Dim code As XmlQualifiedName
Dim actor As String
Dim innerException As Exception

Dim instance As New SoapHeaderException(message, code, actor, innerException)
public SoapHeaderException (
    string message,
    XmlQualifiedName code,
    string actor,
    Exception innerException
)
public:
SoapHeaderException (
    String^ message, 
    XmlQualifiedName^ code, 
    String^ actor, 
    Exception^ innerException
)
public SoapHeaderException (
    String message, 
    XmlQualifiedName code, 
    String actor, 
    Exception innerException
)
public function SoapHeaderException (
    message : String, 
    code : XmlQualifiedName, 
    actor : String, 
    innerException : Exception
)

Parameter

  • message
    Eine Meldung, die die Ursache für das Auftreten der Ausnahme angibt. Mit diesem Parameter wird die Message-Eigenschaft festgelegt.
  • code
    Der Typ des aufgetretenen Fehlers. Mit diesem Parameter wird die Code-Eigenschaft festgelegt.
  • actor
    Der Codeabschnitt, der die Ausnahme verursacht hat. In der Regel ist dies ein URL einer XML-Webdienstmethode. Mit diesem Parameter wird die Actor-Eigenschaft festgelegt.
  • innerException
    Ein Verweis auf die Ursache einer Ausnahme. Mit diesem Parameter wird die InnerException-Eigenschaft festgelegt.

Beispiel

<%@ 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, _
            "https://localhost/MathSvc_SoapHeaderException4.vb.asmx/Add", e)
      End Try
      Return xValue + yValue
   End Function 'Add
End Class 'MathSvc
<%@ 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,
            "https://localhost/MathSvc_SoapHeaderException4.cs.asmx/Add",
            e);
      }
      return(xValue + yValue);
   }
}
import System.*;
import System.Web.Services.*;
import System.Web.Services.Protocols.*;

public class MySoapHeader extends SoapHeader
{
    public int number;
} //MySoapHeader

public class MathSvc extends WebService
{
    public MySoapHeader mySoapHeader;

    /** @attribute WebMethod()
     */
    /** @attribute SoapHeaderAttribute("mySoapHeader", 
            Direction = SoapHeaderDirection.In)
     */
    public float Add(float xValue, float yValue) throws SoapHeaderException
    {
        // Process the header from the client.
        try {
            int j = 100 / mySoapHeader.number;
        }
        catch (System.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, 
                "https://localhost/MathSvc_SoapHeaderException4.cs.asmx/Add", e);
        }
        return xValue + yValue;
    } //Add
} //MathSvc

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0

Siehe auch

Referenz

SoapHeaderException-Klasse
SoapHeaderException-Member
System.Web.Services.Protocols-Namespace