SoapRpcMethodAttribute.Binding プロパティ
アセンブリ: System.Web.Services (system.web.services.dll 内)

Dim instance As SoapRpcMethodAttribute Dim value As String value = instance.Binding instance.Binding = value
/** @property */ public String get_Binding () /** @property */ public void set_Binding (String value)
XML Web サービス メソッドが実装している操作のバインディング。既定値は、"Soap" が追加された XML Web サービスの名前です。

バインディングは、Web サービス記述言語 (WSDL: Web Services Description Language) によって定義されており、具体的な操作のセットを定義している点でインターフェイスと似ています。ASP.NET では、各 XML Web サービス メソッドは 1 つのバインディング内の 1 つの操作です。XML Web サービス メソッドは、XML Web サービスの既定のバインディングのメンバ、または XML Web サービスに適用される WebServiceBindingAttribute 内で指定されたバインディングのメンバになります。XML Web サービスは、複数の WebServiceBindingAttribute 属性が適用されている場合には、複数のバインディングを実装できます。
WebServiceBindingAttribute 属性を XML Web サービスに適用すると、SoapDocumentMethodAttribute または SoapRpcMethodAttribute を個別の XML Web サービス メソッドに適用し、特定の XML Web サービス メソッドによって実装されるバインディング操作を指定できます。SoapDocumentMethodAttribute または SoapRpcMethodAttribute の Binding プロパティを設定して、XML Web サービス メソッドが操作を実装する対象となるバインディングを指定します。XML Web サービス メソッドに適用できるのは、1 つの SoapDocumentMethodAttribute または SoapRpcMethodAttribute だけです。したがって、XML Web サービス メソッドが実装できるのは、1 つのバインディングに対して 1 つの操作だけです。

XML Web サービス内に複数のバインディングを実装する方法を次のコード例に示します。
<%@ WebService Language="VB" class="BindingSample" %> Imports System.Web.Services Imports System.Web.Services.Protocols ' Three bindings are defined < 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 < SoapRpcMethod(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 < SoapRpcMethodAttribute(Binding:="LocalBindingNonDefaultNamespace"), WebMethod > _ Public Function LocalBindingNonDefaultNamespaceMethod() As String Return "Member of binding defined in this XML Web service, but a part of a different namespace" End Function < SoapRpcMethodAttribute(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 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 { [ SoapRpcMethod(Binding="LocalBinding")] [ WebMethod ] public string LocalBindingMethod() { return "Member of binding defined in this XML Web service and member of the default namespace"; } [ SoapRpcMethodAttribute(Binding="LocalBindingNonDefaultNamespace")] [ WebMethod ] public string LocalBindingNonDefaultNamespaceMethod() { return "Member of binding defined in this XML Web service, but a part of a different namespace"; } [ SoapRpcMethodAttribute(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"; } }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- SoapRpcMethodAttribute.Binding プロパティのページへのリンク