SoapRpcMethodAttribute.Binding プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > SoapRpcMethodAttribute.Binding プロパティの意味・解説 

SoapRpcMethodAttribute.Binding プロパティ

XML Web サービス メソッドが実装している操作のバインディングを取得または設定します。

名前空間: System.Web.Services.Protocols
アセンブリ: System.Web.Services (system.web.services.dll 内)
構文構文

解説解説

バインディングは、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";
      }
 
 }   
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SoapRpcMethodAttribute クラス
SoapRpcMethodAttribute メンバ
System.Web.Services.Protocols 名前空間
WebServiceBindingAttribute クラス



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

SoapRpcMethodAttribute.Binding プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SoapRpcMethodAttribute.Binding プロパティのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS