OperationFault Klasa

Definicja

Definiuje specyfikacje komunikatów o błędach zwracanych przez usługę sieci Web XML. Klasa ta nie może być dziedziczona.

public ref class OperationFault sealed : System::Web::Services::Description::OperationMessage
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class OperationFault : System.Web.Services.Description.OperationMessage
public sealed class OperationFault : System.Web.Services.Description.OperationMessage
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type OperationFault = class
    inherit OperationMessage
type OperationFault = class
    inherit OperationMessage
Public NotInheritable Class OperationFault
Inherits OperationMessage
Dziedziczenie
Dziedziczenie
Atrybuty

Przykłady

W poniższym przykładzie pokazano użycie właściwości i metod uwidocznionych przez klasę OperationFault .

#using <System.dll>
#using <System.Web.Services.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Xml;
using namespace System::Xml::Schema;
using namespace System::Xml::Serialization;
int main()
{
   try
   {
      // Read the 'StockQuote_cpp.wsdl' file as input.
      ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" );
      PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes;
      PortType^ myPortType = myPortTypeCollection[ 0 ];
      OperationCollection^ myOperationCollection = myPortType->Operations;
      Operation^ myOperation = myOperationCollection[ 0 ];
      
      OperationFault^ myOperationFault = gcnew OperationFault;
      myOperationFault->Name = "ErrorString";
      myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceStringFault" );
      myOperation->Faults->Add( myOperationFault );
      Console::WriteLine( "Added OperationFault with Name: {0}", myOperationFault->Name );
      myOperationFault = gcnew OperationFault;
      myOperationFault->Name = "ErrorInt";
      myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceIntFault" );
      myOperation->Faults->Add( myOperationFault );

      myOperationCollection->Add( myOperation );
      Console::WriteLine( "Added Second OperationFault with Name: {0}", myOperationFault->Name );
      myServiceDescription->Write( "StockQuoteNew_cpp.wsdl" );
      Console::WriteLine( "\nThe file 'StockQuoteNew_cpp.wsdl' is created successfully." );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception caught!!!" );
      Console::WriteLine( "Source : {0}", e->Source );
      Console::WriteLine( "Message : {0}", e->Message );
   }
}
using System;
using System.Web.Services.Description;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

public class MyOperationFaultSample
{
   public static void Main()
   {
      try
      {
         // Read the 'StockQuote_cs.wsdl' file as input.
         ServiceDescription myServiceDescription = ServiceDescription.
                                               Read("StockQuote_cs.wsdl");
         PortTypeCollection myPortTypeCollection = myServiceDescription.
                                                                PortTypes;
         PortType myPortType = myPortTypeCollection[0];
         OperationCollection myOperationCollection = myPortType.Operations;
         Operation myOperation = myOperationCollection[0];
         OperationFault myOperationFault = new OperationFault();
         myOperationFault.Name = "ErrorString";
         myOperationFault.Message = new XmlQualifiedName
                                          ("s0:GetTradePriceStringFault");
         myOperation.Faults.Add(myOperationFault);
         Console.WriteLine("Added OperationFault with Name: "
                           + myOperationFault.Name);
         myOperationFault = new OperationFault();
         myOperationFault.Name = "ErrorInt";
         myOperationFault.Message = new XmlQualifiedName
                                             ("s0:GetTradePriceIntFault");
         myOperation.Faults.Add(myOperationFault);
         myOperationCollection.Add(myOperation);
         Console.WriteLine("Added Second OperationFault with Name: "
                  +myOperationFault.Name);
         myServiceDescription.Write("StockQuoteNew_cs.wsdl");
         Console.WriteLine("\nThe file 'StockQuoteNew_cs.wsdl' is " +
                           "created successfully.");
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception caught!!!");
         Console.WriteLine("Source : " + e.Source);
         Console.WriteLine("Message : " + e.Message);
      }
   }
}
Imports System.Web.Services.Description
Imports System.Xml
Imports System.Xml.Schema
Imports System.Xml.Serialization

Public Class MyOperationFaultSample
   Public Shared Sub Main()
      Try
         ' Read the 'StockQuote_vb.wsdl' file as input.
         Dim myServiceDescription As ServiceDescription = _
                              ServiceDescription.Read("StockQuote_vb.wsdl")
         Dim myPortTypeCollection As PortTypeCollection = _
                                           myServiceDescription.PortTypes
         Dim myPortType As PortType = myPortTypeCollection(0)
         Dim myOperationCollection As OperationCollection = myPortType.Operations
         Dim myOperation As Operation = myOperationCollection(0)
         Dim myOperationFault As New OperationFault()
         myOperationFault.Name = "ErrorString"
         myOperationFault.Message = _
                        New XmlQualifiedName("s0:GetTradePriceStringFault")
         myOperation.Faults.Add(myOperationFault)
         Console.WriteLine("Added OperationFault with Name: " + _
                                                     myOperationFault.Name)
         myOperationFault = New OperationFault()
         myOperationFault.Name = "ErrorInt"
         myOperationFault.Message = _
                           New XmlQualifiedName("s0:GetTradePriceIntFault")
         myOperation.Faults.Add(myOperationFault)
         myOperationCollection.Add(myOperation)
         Console.WriteLine("Added Second OperationFault with Name: " + _
                                                    myOperationFault.Name)
         myServiceDescription.Write("StockQuoteNew_vb.wsdl")
         Console.WriteLine(ControlChars.NewLine + _
                           "The file 'StockQuoteNew_vb.wsdl' is " + _
                           "created successfully.")
      Catch e As Exception
         Console.WriteLine("Exception caught!!!")
         Console.WriteLine("Source : " + e.Source)
         Console.WriteLine("Message : " + e.Message)
      End Try
   End Sub
End Class

Uwagi

Wystąpienia tej klasy są elementami członkowskimi Faults właściwości wystąpienia nadrzędnego Operation .

Klasa OperationFault odpowiada elementowi WSDL (Web Services Description Language) fault ujętemu operation w element, który jest z kolei ujęta w portType element . Aby uzyskać więcej informacji na temat języka WSDL, zobacz specyfikację WSDL .

Konstruktory

OperationFault()

Inicjuje nowe wystąpienie klasy OperationFault.

Właściwości

Documentation

Pobiera lub ustawia dokumentację tekstu dla wystąpienia klasy DocumentableItem.

(Odziedziczone po DocumentableItem)
DocumentationElement

Pobiera lub ustawia element dokumentacji dla elementu DocumentableItem.

(Odziedziczone po DocumentableItem)
ExtensibleAttributes

Pobiera lub ustawia tablicę typu XmlAttribute reprezentującą rozszerzenia atrybutów języka WSDL w celu zachowania zgodności z podstawowym profilem 1.1 usług sieci Web (WS-I).

(Odziedziczone po DocumentableItem)
Extensions

ServiceDescriptionFormatExtensionCollection Pobiera element skojarzony z tym OperationFaultelementem .

Extensions

ServiceDescriptionFormatExtensionCollection Pobiera element skojarzony z tym DocumentableItemelementem .

(Odziedziczone po DocumentableItem)
Message

Pobiera lub ustawia abstrakcyjną, typizowane definicje przekazywanych danych.

(Odziedziczone po OperationMessage)
Name

Pobiera lub ustawia nazwę .OperationMessage

(Odziedziczone po OperationMessage)
Namespaces

Pobiera lub ustawia słownik prefiksów przestrzeni nazw i przestrzeni nazw używanych do zachowywania prefiksów przestrzeni nazw i przestrzeni nazw podczas ServiceDescription konstruowania obiektu.

(Odziedziczone po DocumentableItem)
Operation

Pobiera element Operation , z którego OperationMessage element jest członkiem.

(Odziedziczone po OperationMessage)

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Dotyczy

Zobacz też