SoapFaultBinding Clase

Definición

Representa un elemento de extensibilidad agregado a un objeto FaultBinding incluido en un servicio Web XML.

public ref class SoapFaultBinding : System::Web::Services::Description::ServiceDescriptionFormatExtension
[System.Web.Services.Configuration.XmlFormatExtension("fault", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.FaultBinding))]
public class SoapFaultBinding : System.Web.Services.Description.ServiceDescriptionFormatExtension
[<System.Web.Services.Configuration.XmlFormatExtension("fault", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.FaultBinding))>]
type SoapFaultBinding = class
    inherit ServiceDescriptionFormatExtension
Public Class SoapFaultBinding
Inherits ServiceDescriptionFormatExtension
Herencia
Derivado
Atributos

Ejemplos

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

using namespace System;
using namespace System::Web::Services::Description;

int main()
{
   try
   {
      // Input wsdl file.
      String^ myInputWsdlFile = "SoapFaultBindingInput_cpp.wsdl";

      // Output wsdl file.
      String^ myOutputWsdlFile = "SoapFaultBindingOutput_cpp.wsdl";

      // Initialize an instance of a 'ServiceDescription' object.
      ServiceDescription^ myServiceDescription = ServiceDescription::Read( myInputWsdlFile );

      // Get a SOAP binding object with binding name S"MyService1Soap".
      Binding^ myBinding = myServiceDescription->Bindings[ "MyService1Soap" ];

      // Create a new instance of 'SoapFaultBinding' class.
      SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding;

      // Encode fault message using rules specified by 'Encoding' property.
      mySoapFaultBinding->Use = SoapBindingUse::Encoded;

      // Set the URI representing the encoding style.
      mySoapFaultBinding->Encoding = "http://tempuri.org/stockquote";

      // Set the URI representing the location of the specification
      // for encoding of content not defined by 'Encoding' property'.
      mySoapFaultBinding->Namespace = "http://tempuri.org/stockquote";

      // Create a new instance of 'FaultBinding'.
      FaultBinding^ myFaultBinding = gcnew FaultBinding;
      myFaultBinding->Name = "AddFaultbinding";
      myFaultBinding->Extensions->Add( mySoapFaultBinding );

      // Get existing 'OperationBinding' object.
      OperationBinding^ myOperationBinding = myBinding->Operations[ 0 ];
      myOperationBinding->Faults->Add( myFaultBinding );

      // Create a new wsdl file.
      myServiceDescription->Write( myOutputWsdlFile );
      Console::WriteLine( "The new wsdl file created is : {0}", myOutputWsdlFile );
      Console::WriteLine( "Proxy could be created using command : wsdl {0}", myOutputWsdlFile );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Error occurred : {0}", e->Message );
   }
}
using System;
using System.Web.Services.Description;
public class MySoapFaultBindingSample
{
   public static void Main()
   {
      try
      {
         // Input wsdl file.
         string myInputWsdlFile="SoapFaultBindingInput_cs.wsdl";
         // Output wsdl file.
         string myOutputWsdlFile="SoapFaultBindingOutput_cs.wsdl";
         // Initialize an instance of a 'ServiceDescription' object.
         ServiceDescription myServiceDescription =
            ServiceDescription.Read(myInputWsdlFile);
         // Get a SOAP binding object with binding name "MyService1Soap".
         Binding myBinding=myServiceDescription.Bindings["MyService1Soap"];
         // Create a new instance of 'SoapFaultBinding' class.
         SoapFaultBinding mySoapFaultBinding=new SoapFaultBinding();
         // Encode fault message using rules specified by 'Encoding' property.
         mySoapFaultBinding.Use=SoapBindingUse.Encoded;
         // Set the URI representing the encoding style.
         mySoapFaultBinding.Encoding="http://tempuri.org/stockquote";
         // Set the URI representing the location of the specification
         // for encoding of content not defined by 'Encoding' property'.
         mySoapFaultBinding.Namespace="http://tempuri.org/stockquote";
         // Create a new instance of 'FaultBinding'.
         FaultBinding myFaultBinding=new FaultBinding();
         myFaultBinding.Name="AddFaultbinding";
         myFaultBinding.Extensions.Add(mySoapFaultBinding);
         // Get existing 'OperationBinding' object.
         OperationBinding myOperationBinding=myBinding.Operations[0];
         myOperationBinding.Faults.Add(myFaultBinding);
         // Create a new wsdl file.
         myServiceDescription.Write(myOutputWsdlFile);
         Console.WriteLine("The new wsdl file created is :"
                           +myOutputWsdlFile);
         Console.WriteLine("Proxy could be created using command : wsdl "
                             + myOutputWsdlFile);
      }
      catch(Exception e)
      {
         Console.WriteLine("Error occurred : "+e.Message);
      }
   }
}
Imports System.Web.Services.Description

Public Class MySoapFaultBindingSample
   
   Public Shared Sub Main()
      Try
         ' Input wsdl file.
         Dim myInputWsdlFile As String = "SoapFaultBindingInput_vb.wsdl"
         ' Output wsdl file.
         Dim myOutputWsdlFile As String = "SoapFaultBindingOutput_vb.wsdl"
         ' Initialize an instance of a 'ServiceDescription' object.
         Dim myServiceDescription As ServiceDescription = ServiceDescription.Read(myInputWsdlFile)
         ' Get a SOAP binding object with binding name "MyService1Soap". 
         Dim myBinding As Binding = myServiceDescription.Bindings("MyService1Soap")
         ' Create a new instance of 'SoapFaultBinding' class.
         Dim mySoapFaultBinding As New SoapFaultBinding()
         ' Encode fault message using rules specified by 'Encoding' property.
         mySoapFaultBinding.Use = SoapBindingUse.Encoded
         ' Set the URI representing the encoding style.
         mySoapFaultBinding.Encoding = "http://tempuri.org/stockquote"
         ' Set the URI representing the location of the specification
         ' for encoding of content not defined by 'Encoding' property'.
         mySoapFaultBinding.Namespace = "http://tempuri.org/stockquote"
         ' Create a new instance of 'FaultBinding'.
         Dim myFaultBinding As New FaultBinding()
         myFaultBinding.Name = "AddFaultbinding"
         myFaultBinding.Extensions.Add(mySoapFaultBinding)
         ' Get existing 'OperationBinding' object.
         Dim myOperationBinding As OperationBinding = myBinding.Operations(0)
         myOperationBinding.Faults.Add(myFaultBinding)
         ' Create a new wsdl file.
         myServiceDescription.Write(myOutputWsdlFile)
         Console.WriteLine("The new wsdl file created is :" + myOutputWsdlFile)
         Console.WriteLine("Proxy could be created using command : wsdl /language:VB " + myOutputWsdlFile)
      Catch e As Exception
         Console.WriteLine("Error occurred : " + e.Message.ToString())
      End Try
   End Sub
End Class

Comentarios

Esta clase especifica el contenido de cualquier mensaje de error SOAP devuelto.

Para obtener más información sobre cómo especificar protocolos para servicios web XML, vea Servicios web XML mediante ASP.NET. Para obtener más información sobre el lenguaje de descripción de servicios web (WSDL), consulte la especificación WSDL .

Constructores

SoapFaultBinding()

Inicializa una instancia de la clase SoapFaultBinding.

Propiedades

Encoding

Obtiene o establece un identificador URI que representa el estilo de codificación utilizado para codificar el mensaje de error SOAP.

Handled

Obtiene o establece un valor que indica si ServiceDescriptionFormatExtension se utiliza en el proceso de importación cuando se importa el elemento de extensibilidad.

(Heredado de ServiceDescriptionFormatExtension)
Name

Obtiene o establece el valor del atributo de nombre que relaciona el error de SOAP al error de WSDL definido para la operación especificada.

Namespace

Obtiene o establece el URI que representa la ubicación de la especificación correspondiente a la codificación del contenido no definido específicamente por la propiedad Encoding.

Parent

Obtiene el objeto principal de ServiceDescriptionFormatExtension.

(Heredado de ServiceDescriptionFormatExtension)
Required

Obtiene o establece un valor que indica si ServiceDescriptionFormatExtension es necesario para la acción a la que hace referencia.

(Heredado de ServiceDescriptionFormatExtension)
Use

Especifica si el mensaje de error se codifica utilizando las reglas especificadas por la propiedad Encoding o se encapsula en un esquema XML concreto.

Métodos

Equals(Object)

Determina si el objeto especificado es igual que el objeto actual.

(Heredado de Object)
GetHashCode()

Sirve como la función hash predeterminada.

(Heredado de Object)
GetType()

Obtiene el Type de la instancia actual.

(Heredado de Object)
MemberwiseClone()

Crea una copia superficial del Object actual.

(Heredado de Object)
ToString()

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Se aplica a