Sdílet prostřednictvím


OperationFault Třída

Definice

Definuje specifikace chybových zpráv vrácených webovou službou XML. Tuto třídu nelze dědit.

public ref class OperationFault sealed : System::Web::Services::Description::OperationMessage
public sealed class OperationFault : System.Web.Services.Description.OperationMessage
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class OperationFault : System.Web.Services.Description.OperationMessage
type OperationFault = class
    inherit OperationMessage
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type OperationFault = class
    inherit OperationMessage
Public NotInheritable Class OperationFault
Inherits OperationMessage
Dědičnost
Dědičnost
Atributy

Příklady

Následující příklad ukazuje použití vlastností a metod vystavených OperationFault třídou.

#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

Poznámky

Instance této třídy jsou členy Faults vlastnosti nadřazené Operation instance.

Třída OperationFault odpovídá elementu WSDL (Web Services Description Language) fault uzavřenému operation elementem, který je zase uzavřen elementem portType . Další informace o WSDL naleznete ve specifikaci WSDL .

Konstruktory

OperationFault()

Inicializuje novou instanci OperationFault třídy.

Vlastnosti

Documentation

Získá nebo nastaví textovou dokumentaci pro instanci DocumentableItem.

(Zděděno od DocumentableItem)
DocumentationElement

Získá nebo nastaví prvek dokumentace pro DocumentableItem.

(Zděděno od DocumentableItem)
ExtensibleAttributes

Získá nebo nastaví pole typu XmlAttribute , který představuje rozšíření atributů WSDL, aby byly v souladu s webovými službami Interoperability (WS-I) Basic Profile 1.1.

(Zděděno od DocumentableItem)
Extensions

ServiceDescriptionFormatExtensionCollection Získá přidružené k tomuto OperationFault.

Extensions

ServiceDescriptionFormatExtensionCollection Získá přidružené k tomuto DocumentableItem.

(Zděděno od DocumentableItem)
Message

Získá nebo nastaví abstraktní definici dat, která se komunikují.

(Zděděno od OperationMessage)
Name

Získá nebo nastaví název .OperationMessage

(Zděděno od OperationMessage)
Namespaces

Získá nebo nastaví slovník předpon oboru názvů a obory názvů použité k zachování předpon oboru názvů a oborů názvů při vytvoření objektu ServiceDescription .

(Zděděno od DocumentableItem)
Operation

Operation Získá, z nichž OperationMessage je členem.

(Zděděno od OperationMessage)

Metody

Equals(Object)

Určí, zda se zadaný objekt rovná aktuálnímu objektu.

(Zděděno od Object)
GetHashCode()

Slouží jako výchozí funkce hash.

(Zděděno od Object)
GetType()

Type Získá aktuální instanci.

(Zděděno od Object)
MemberwiseClone()

Vytvoří použádnou kopii aktuálního souboru Object.

(Zděděno od Object)
ToString()

Vrátí řetězec, který představuje aktuální objekt.

(Zděděno od Object)

Platí pro

Viz také