WebServiceBindingAttribute WebServiceBindingAttribute WebServiceBindingAttribute WebServiceBindingAttribute Class

Definición

Declara un enlace que define uno o más métodos de servicios Web XML.Declares a binding that defines one or more XML Web service methods. Esta clase no puede heredarse.This class cannot be inherited.

public ref class WebServiceBindingAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true, Inherited=true)]
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true)]
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true)]
public sealed class WebServiceBindingAttribute : Attribute
type WebServiceBindingAttribute = class
    inherit Attribute
Public NotInheritable Class WebServiceBindingAttribute
Inherits Attribute
Herencia
WebServiceBindingAttributeWebServiceBindingAttributeWebServiceBindingAttributeWebServiceBindingAttribute
Atributos

Ejemplos

El siguiente servicio Web XML implementa operaciones de cuatro enlaces.The following XML Web service implements operations from four bindings. En concreto, el servicio Web XML declara tres enlaces para los que implementa operaciones, aplicando tres WebServiceBindingAttribute atributos para el servicio Web XML.Specifically, the XML Web service declares three bindings it implements operations for, by applying three WebServiceBindingAttribute attributes to the XML Web service.

Para especificar el enlace para el cual un método de servicios Web XML está implementando una operación, un SoapDocumentMethodAttribute se aplica a cada uno de los métodos de servicio Web XML, excepto DefaultBindingMethod.To specify which binding an XML Web service method is implementing an operation for, a SoapDocumentMethodAttribute is applied to each of the XML Web service methods, except DefaultBindingMethod. Si no especifica un enlace para DefaultBindingMethod, que implementa una operación en el enlace predeterminado para el servicio Web XML.By not specifying a binding for DefaultBindingMethod, it is implementing an operation on the default binding for the XML Web service.

<%@ WebService Language="C#" class="BindingSample" %>
 using System;
 using System.Web.Services;
 using System.Web.Services.Protocols;

 // Binding is defined in this XML Web service and uses the default namespace.
 [ WebServiceBinding(Name="LocalBinding")]

 // Binding is defined in this XML Web service, but it is not a part of the default namespace.
 [ WebServiceBinding(Name="LocalBindingNonDefaultNamespace", 
		     Namespace="http://www.contoso.com/MyBinding" )]

 // Binding is defined on a remote server, but this XML Web service implements at least one operation in that binding.
 [ WebServiceBinding(Name="RemoteBinding", 
		  Namespace="http://www.contoso.com/MyBinding",
		  Location="http://www.contoso.com/MySevice.asmx?wsdl")]
 public class BindingSample  {

      [ SoapDocumentMethod(Binding="LocalBinding")]
      [ WebMethod() ]
      public string LocalBindingMethod() {
               return "Member of binding defined in this XML Web service and member of the default namespace";
      }
      [ SoapDocumentMethod(Binding="LocalBindingNonDefaultNamespace")] 
      [ WebMethod() ]
      public string LocalBindingNonDefaultNamespaceMethod() {
              return "Member of binding defined in this XML Web service, but a part of a different namespace";
      }

     [ SoapDocumentMethod(Binding="RemoteBinding")] 
     [ WebMethod() ]
      public string RemoteBindingMethod() {
              return "Member of a binding defined on another server";
      }

      [ WebMethod() ]
      public string DefaultBindingMethod() {
              return "Member of the default binding";
      }
 
 }
<%@ WebService Language="VB" class="BindingSample" %>
Imports System
Imports System.Web.Services
Imports System.Web.Services.Protocols

' Binding is defined in this XML Web service and uses the default namespace.
' Binding is defined in this XML Web service, but it is not a part of the default
' namespace.
' Binding is defined on a remote server, but this XML Web service implements at
' least one operation in that binding.
<WebServiceBinding(Name := "LocalBinding"), _ 
 WebServiceBinding(Name := "LocalBindingNonDefaultNamespace", _ 
                   Namespace := "http://www.contoso.com/MyBinding"), _     
 WebServiceBinding(Name := "RemoteBinding", _ 
                   Namespace := "http://www.contoso.com/MyBinding", _
                   Location := "http://www.contoso.com/MySevice.asmx?wsdl")> _
Public Class BindingSample
    
    <SoapDocumentMethod(Binding := "LocalBinding"), WebMethod()> _
    Public Function LocalBindingMethod() As String
        
        Return "Member of binding defined in this XML Web service and member of the default namespace"
    End Function
    
    <SoapDocumentMethod(Binding := "LocalBindingNonDefaultNamespace"), WebMethod()> _
    Public Function LocalBindingNonDefaultNamespaceMethod() As String
    
        Return "Member o1f binding defined in this XML Web service, but a part of a different namespace"
    End Function    
    
    <SoapDocumentMethod(Binding := "RemoteBinding"), WebMethod()> _
    Public Function RemoteBindingMethod() As String
    
        Return "Member of a binding defined on another server"
    End Function    
    
    <WebMethod()> _
    Public Function DefaultBindingMethod() As String
    
        Return "Member of the default binding"
    End Function
End Class

Comentarios

Un enlace, tal como se define mediante el lenguaje de descripción de servicios de Web (WSDL), es similar a una interfaz, ya que define un conjunto concreto de operaciones.A binding, as defined by Web Services Description Language (WSDL), is similar to an interface, in that it defines a concrete set of operations. Cada método de servicios Web XML es una operación dentro de un enlace determinado.Each XML Web service method is an operation within a particular binding. Métodos de servicio Web XML son miembros del enlace predeterminado de un servicio Web XML o un enlace especificado en un WebServiceBindingAttribute aplicado a una clase que implementa un servicio Web XML.XML Web service methods are members of either the default binding for an XML Web service or a binding specified within a WebServiceBindingAttribute applied to a class implementing an XML Web service. Un servicio Web XML puede implementar varios enlaces, aplicando varias WebServiceBindingAttribute atributos a un servicio Web XML.An XML Web service can implement multiple bindings, by applying multiple WebServiceBindingAttribute attributes to an XML Web service.

Una vez que uno o varios WebServiceAttribute atributos se aplican a un servicio Web XML, un SoapDocumentMethodAttribute o SoapRpcMethodAttribute puede aplicarse a los métodos de servicio Web XML individuales para indicar la operación de enlace que implementa un método de servicio Web XML determinado.Once one or more WebServiceAttribute attributes are applied to an XML Web service, a SoapDocumentMethodAttribute or SoapRpcMethodAttribute can be applied to individual XML Web service methods to indicate the binding operation implemented by a particular XML Web service method. Establecer el Binding propiedad de SoapDocumentMethodAttribute o SoapRpcMethodAttribute para especificar el enlace de un método de servicios Web XML está implementando una operación para.Set the Binding property of SoapDocumentMethodAttribute or SoapRpcMethodAttribute to specify the binding an XML Web service method is implementing an operation for.

Constructores

WebServiceBindingAttribute() WebServiceBindingAttribute() WebServiceBindingAttribute() WebServiceBindingAttribute()

Inicializa una nueva instancia de la clase WebServiceBindingAttribute.Initializes a new instance of the WebServiceBindingAttribute class.

WebServiceBindingAttribute(String) WebServiceBindingAttribute(String) WebServiceBindingAttribute(String) WebServiceBindingAttribute(String)

Inicializa una nueva instancia de la clase WebServiceBindingAttribute estableciendo el nombre del enlace que el método de servicios Web XML está implementando.Initializes a new instance of the WebServiceBindingAttribute class setting the name of the binding the XML Web service method is implementing.

WebServiceBindingAttribute(String, String) WebServiceBindingAttribute(String, String) WebServiceBindingAttribute(String, String) WebServiceBindingAttribute(String, String)

Inicializa una nueva instancia de la clase WebServiceBindingAttribute.Initializes a new instance of the WebServiceBindingAttribute class.

WebServiceBindingAttribute(String, String, String) WebServiceBindingAttribute(String, String, String) WebServiceBindingAttribute(String, String, String) WebServiceBindingAttribute(String, String, String)

Inicializa una nueva instancia de la clase WebServiceBindingAttribute.Initializes a new instance of the WebServiceBindingAttribute class.

Propiedades

ConformsTo ConformsTo ConformsTo ConformsTo

Obtiene o establece la especificación de la interoperabilidad de los servicios Web (WSI) a la que el enlace solicita su conformidad.Gets or sets the Web Services Interoperability (WSI) specification to which the binding claims to conform.

EmitConformanceClaims EmitConformanceClaims EmitConformanceClaims EmitConformanceClaims

Obtiene o establece un valor que indica si el enlace emite las solicitudes de conformidad.Gets or sets a value that indicates whether the binding emits conformance claims.

Location Location Location Location

Obtiene o establece la ubicación donde se define el enlace.Gets or sets the location where the binding is defined.

Name Name Name Name

Obtiene o establece el nombre del enlace.Gets or sets the name of the binding.

Namespace Namespace Namespace Namespace

Obtiene o establece el espacio de nombres asociado al enlace.Gets or sets the namespace associated with the binding.

TypeId TypeId TypeId TypeId

Cuando se implementa en una clase derivada, obtiene un identificador único para este Attribute.When implemented in a derived class, gets a unique identifier for this Attribute.

(Inherited from Attribute)

Métodos

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Devuelve un valor que indica si esta instancia es igual que un objeto especificado.Returns a value that indicates whether this instance is equal to a specified object.

(Inherited from Attribute)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Devuelve el código hash de esta instancia.Returns the hash code for this instance.

(Inherited from Attribute)
GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual.Gets the Type of the current instance.

(Inherited from Object)
IsDefaultAttribute() IsDefaultAttribute() IsDefaultAttribute() IsDefaultAttribute()

Si se reemplaza en una clase derivada, indica si el valor de esta instancia es el valor predeterminado de la clase derivada.When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class.

(Inherited from Attribute)
Match(Object) Match(Object) Match(Object) Match(Object)

Cuando se invalida en una clase derivada, devuelve un valor que indica si esta instancia es igual a un objeto especificado.When overridden in a derived class, returns a value that indicates whether this instance equals a specified object.

(Inherited from Attribute)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del objeto Object actual.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual.Returns a string that represents the current object.

(Inherited from Object)

Implementaciones de interfaz explícitas

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

Asigna un conjunto de nombres a un conjunto correspondiente de identificadores de envío.Maps a set of names to a corresponding set of dispatch identifiers.

(Inherited from Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Obtiene la información de tipos de un objeto, que puede utilizarse para obtener la información de tipos de una interfaz.Retrieves the type information for an object, which can be used to get the type information for an interface.

(Inherited from Attribute)
_Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32) _Attribute.GetTypeInfoCount(UInt32)

Recupera el número de interfaces de información de tipo que proporciona un objeto (0 ó 1).Retrieves the number of type information interfaces that an object provides (either 0 or 1).

(Inherited from Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Proporciona acceso a las propiedades y los métodos expuestos por un objeto.Provides access to properties and methods exposed by an object.

(Inherited from Attribute)

Se aplica a

Consulte también: