Declara un enlace que define uno o más métodos de servicios Web XML. No se puede heredar esta clase.
Espacio de nombres: System.Web.Services
Ensamblado: System.Web.Services (en system.web.services.dll)
Visual Basic (Declaración)
<AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Interface, AllowMultiple:=True)> _
Public NotInheritable Class WebServiceBindingAttribute
Inherits Attribute
Dim instance As WebServiceBindingAttribute
[AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple=true)]
public sealed class WebServiceBindingAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Interface, AllowMultiple=true)]
public ref class WebServiceBindingAttribute sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple=true) */
public final class WebServiceBindingAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple=true)
public final class WebServiceBindingAttribute extends Attribute
Un enlace, según define el Lenguaje de descripción de servicios Web (WSDL), es similar a una interfaz ya que define un conjunto concreto de operaciones. Cada método de servicios Web XML es una operación dentro de un enlace determinado. Los métodos de servicios Web XML son miembros del enlace predeterminado de un servicio Web XML o de un enlace especificado en un control WebServiceBindingAttribute que se aplica a una clase que implementa un servicio Web XML. Un servicio Web XML puede implementar varios enlaces aplicando varios atributos WebServiceBindingAttribute a un servicio Web XML.
Después de aplicar uno o varios atributos WebServiceAttribute a un servicio Web XML, se puede aplicar SoapDocumentMethodAttribute o SoapRpcMethodAttribute a métodos individuales de servicios Web XML para indicar la operación de enlace que implementa un método determinado de servicios Web XML. Establezca la propiedad Binding de SoapDocumentMethodAttribute o SoapRpcMethodAttribute para especificar el enlace para el que un método de servicios Web XML está implementando una operación.
El siguiente servicio Web XML implementa operaciones de cuatro enlaces. Concretamente, el servicio Web XML declara tres enlaces para los que implementa operaciones, aplicando tres atributos WebServiceBindingAttribute al servicio Web XML.
Para especificar el enlace para el cual está implementando una operación el método de servicios Web XML, se aplica un atributo SoapDocumentMethodAttribute a cada uno de los métodos de servicios Web XML, excepto DefaultBindingMethod. Si no se especifica un enlace para DefaultBindingMethod, implementará una operación en el enlace predeterminado del servicio Web XML.
<%@ 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
<%@ 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";
}
}
System.Object
System.Attribute
System.Web.Services.WebServiceBindingAttribute
Seguridad para subprocesos
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