Versión imprimible       Enviar     
Evaluar y enviar comentarios

  Encender vista de ancho de banda bajo
Esta página es específica de
Microsoft Visual Studio 2005/.NET Framework 2.0

Hay además otras versiones disponibles para:
SoapExtensionAttribute (Clase)
Cuando se reemplaza en una clase derivada, especifica que la extensión SOAP debe ejecutarse con un método de servicios Web XML.

Espacio de nombres: System.Web.Services.Protocols
Ensamblado: System.Web.Services (en system.web.services.dll)

Visual Basic (Declaración)
Public MustInherit Class SoapExtensionAttribute
    Inherits Attribute
Visual Basic (Uso)
Dim instance As SoapExtensionAttribute
C#
public abstract class SoapExtensionAttribute : Attribute
C++
public ref class SoapExtensionAttribute abstract : public Attribute
J#
public abstract class SoapExtensionAttribute extends Attribute
JScript
public abstract class SoapExtensionAttribute extends Attribute
XAML
No aplicable.

Se pueden configurar métodos de servicios Web XML creados mediante ASP.NET para que se ejecuten con una extensión SOAP aplicando un atributo a dichos métodos. Cuando se agrega un atributo de extensión personalizado a un método de servicios Web XML o a un método de una clase de proxy cliente, ASP.NET llama a la extensión asociada en el momento adecuado. Un atributo de extensión es una clase de atributo personalizado que se deriva de SoapExtensionAttribute. Los atributos derivados deben reemplazar a la propiedad ExtensionType para devolver el tipo de extensión asociado al atributo.

La siguiente clase TraceExtensionAttribute se deriva de SoapExtensionAttribute para permitir que se aplique el atributo a un método de servicios Web XML o a un método de una clase de proxy del cliente de servicios Web XML. Cuando se aplica a alguno de estos métodos, la extensión SOAP TraceExtension se ejecuta con el método.

Visual Basic
' Create a SoapExtensionAttribute for a SOAP extension that can be
' applied to an XML Web service method.
<AttributeUsage(AttributeTargets.Method)> _
Public Class TraceExtensionAttribute
    Inherits SoapExtensionAttribute
    
    Private m_filename As String = "c:\log.txt"
    Private m_priority As Integer

   ' Return the type of 'TraceExtension' class.
    Public Overrides ReadOnly Property ExtensionType() As Type
        Get
            Return GetType(TraceExtension)
        End Get
    End Property

   ' User can set priority of the 'TraceExtension'.
    Public Overrides Property Priority() As Integer
        Get
            Return m_priority
        End Get
        Set(ByVal Value As Integer)
            m_priority = value
        End Set
    End Property

    Public Property Filename() As String
        Get
            Return m_filename
        End Get
        Set(ByVal Value As String)
            m_filename = value
        End Set
    End Property
End Class
C#
// Create a SoapExtensionAttribute for a SOAP extension that can be
// applied to an XML Web service method.
[AttributeUsage(AttributeTargets.Method)]
public class TraceExtensionAttribute : SoapExtensionAttribute {

    private string myFilename;
    private int myPriority;


    // Set the name of the log file were SOAP messages will be stored.
    public TraceExtensionAttribute() : base()
    {
        myFilename = "C:\\logClient.txt";
    }

    // Return the type of 'TraceExtension' class.
    public override Type ExtensionType
    {
        get
        {
            return typeof(TraceExtension);
        }
    }

    // User can set priority of the 'SoapExtension'.
    public override int Priority 
    {
        get 
        {
            return myPriority;
        }
        set 
        { 
            myPriority = value;
        }
    }

    public string Filename 
    {
        get
        {
            return myFilename;
        }
        set
        {
            myFilename = value;
        }
    }
}
C++
// Create a SoapExtensionAttribute for a SOAP extension that can be
// applied to an XML Web service method.

[AttributeUsage(AttributeTargets::Method)]
public ref class TraceExtensionAttribute: public SoapExtensionAttribute
{
private:
   String^ myFilename;
   int myPriority;

public:

   // Set the name of the log file were SOAP messages will be stored.
   TraceExtensionAttribute()
      : SoapExtensionAttribute()
   {
      myFilename = "C:\\logClient.txt";
   }

   property Type^ ExtensionType 
   {
      // Return the type of 'TraceExtension' class.
      virtual Type^ get() override
      {
         return TraceExtension::typeid;
      }
   }

   property int Priority 
   {
      // User can set priority of the 'SoapExtension'.
      virtual int get() override
      {
         return myPriority;
      }

      virtual void set( int value ) override
      {
         myPriority = value;
      }
   }

   property String^ Filename 
   {
      String^ get()
      {
         return myFilename;
      }

      void set( String^ value )
      {
         myFilename = value;
      }
   }
};
J#
// Create a SoapExtensionAttribute for a SOAP extension that can be
// applied to an XML Web service method.
/** @attribute AttributeUsage(AttributeTargets.Method)
 */
public class TraceExtensionAttribute extends SoapExtensionAttribute
{
    private String myFilename;
    private int myPriority;

    // Set the name of the log file were SOAP messages will be stored.
    public TraceExtensionAttribute()
    {
        myFilename = "C:\\logClient.txt";
    } //TraceExtensionAttribute

    // Return the type of 'TraceExtension' class.
    public Type get_ExtensionType()
    {
        return TraceExtension.class.ToType();
    } //get_ExtensionType

    // User can set priority of the 'SoapExtension'.
    public int get_Priority()
    {
        return myPriority;
    } //get_Priority

    public void set_Priority(int value)
    {
        myPriority = value;
    } //set_Priority

    public String get_Filename()
    {
        return myFilename;
    } //get_Filename

    public void set_Filename(String value)
    {
        myFilename = value;
    } //set_Filename
} //TraceExtensionAttribute
System.Object
   System.Attribute
    System.Web.Services.Protocols.SoapExtensionAttribute
Los miembros estáticos públicos (Shared en Visual Basic) de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.

Windows 98, Windows 2000 Service Pack 4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter

Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.

.NET Framework

Compatible con: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Compatible con: 2.0, 1.0
© 2009 Microsoft Corporation. Reservados todos los derechos. Términos de uso  |  Marcas Registradas  |  Privacidad
Page view tracker