Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Initialisiert eine neue Instanz der SoapException-Klasse mit der angegebenen Ausnahmemeldung, dem Ausnahmecode, den anwendungsspezifischen Ausnahmeinformationen und dem URI, der den für die Ausnahme verantwortlichen Codeabschnitt identifiziert.
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, _
detail As XmlNode _
)
'Usage
Dim message As String
Dim code As XmlQualifiedName
Dim actor As String
Dim detail As XmlNode
Dim instance As New SoapException(message, code, actor, detail)
public SoapException (
string message,
XmlQualifiedName code,
string actor,
XmlNode detail
)
public:
SoapException (
String^ message,
XmlQualifiedName^ code,
String^ actor,
XmlNode^ detail
)
public SoapException (
String message,
XmlQualifiedName code,
String actor,
XmlNode detail
)
public function SoapException (
message : String,
code : XmlQualifiedName,
actor : String,
detail : XmlNode
)
Parameter
- message
Eine Meldung, die die Ursache für das Auftreten der Ausnahme angibt. Mit diesem Parameter wird die Message-Eigenschaft festgelegt.
- code
Ein XmlQualifiedName, der den Typ des aufgetretenen Fehlers angibt. Mit diesem Parameter wird die Code-Eigenschaft festgelegt.
- actor
Ein URI, der den für die Ausnahme verantwortlichen Codeabschnitt identifiziert. In der Regel ist dies ein URL einer XML-Webdienstmethode. Mit diesem Parameter wird die Actor-Eigenschaft festgelegt.
- detail
Ein XmlNode mit anwendungsspezifischen Ausnahmeinformationen. Mit diesem Parameter wird die Detail-Eigenschaft festgelegt.
Beispiel
<%@ WebService Language="VB" class="ThrowSoapException"%>
Imports System
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
Imports System.Xml
Public Class ThrowSoapException
Inherits WebService
' This XML Web service method generates a SOAP client fault code.
<WebMethod()> _
Public Sub myThrow()
' Build the detail element of the SOAP fault.
Dim doc As New System.Xml.XmlDocument()
Dim node As System.Xml.XmlNode = doc.CreateNode(XmlNodeType.Element, _
SoapException.DetailElementName.Name, _
SoapException.DetailElementName.Namespace)
' Build specific details for the SoapException.
' Add first child of detail XML element.
Dim details As System.Xml.XmlNode = doc.CreateNode(XmlNodeType.Element, _
"mySpecialInfo1", "http://tempuri.org/")
' Add second child of detail XML element with an attribute.
Dim details2 As System.Xml.XmlNode = doc.CreateNode(XmlNodeType.Element, _
"mySpecialInfo2", "http://tempuri.org/")
Dim attr As XmlAttribute = doc.CreateAttribute("t", "attrName", _
"http://tempuri.org/")
attr.Value = "attrValue"
details2.Attributes.Append(attr)
' Append the two child elements to the detail node.
node.AppendChild(details)
node.AppendChild(details2)
' Throw the exception.
Dim se As New SoapException("Fault occurred", SoapException.ClientFaultCode, _
Context.Request.Url.AbsoluteUri, node)
Throw se
Return
End Sub
End Class
<%@ WebService Language="C#" class="ThrowSoapException"%>
using System;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
using System.Xml;
public class ThrowSoapException : WebService
{
// This XML Web service method generates a SOAP client fault code.
[WebMethod]
public void myThrow(){
// Build the detail element of the SOAP fault.
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlNode node = doc.CreateNode(XmlNodeType.Element,
SoapException.DetailElementName.Name,
SoapException.DetailElementName.Namespace);
// Build specific details for the SoapException.
// Add first child of detail XML element.
System.Xml.XmlNode details = doc.CreateNode(XmlNodeType.Element,
"mySpecialInfo1", "http://tempuri.org/");
System.Xml.XmlNode detailsChild = doc.CreateNode(XmlNodeType.Element,
"childOfSpecialInfo", "http://tempuri.org/");
details.AppendChild(detailsChild);
// Add second child of detail XML element with an attribute.
System.Xml.XmlNode details2 = doc.CreateNode(XmlNodeType.Element,
"mySpecialInfo2", "http://tempuri.org/");
XmlAttribute attr = doc.CreateAttribute("t", "attrName",
"http://tempuri.org/");
attr.Value = "attrValue";
details2.Attributes.Append(attr);
// Append the two child elements to the detail node.
node.AppendChild(details);
node.AppendChild(details2);
//Throw the exception.
SoapException se = new SoapException("Fault occurred",
SoapException.ClientFaultCode,Context.Request.Url.AbsoluteUri,node);
throw se;
return; }
}
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, 1.0
Siehe auch
Referenz
SoapException-Klasse
SoapException-Member
System.Web.Services.Protocols-Namespace