WebServiceBindingAttribute クラス

定義

1 つ以上の XML Web サービス メソッドを定義するバインディングを宣言します。 このクラスは継承できません。

public ref class WebServiceBindingAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true)]
public sealed class WebServiceBindingAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true)]
public sealed class WebServiceBindingAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true)>]
type WebServiceBindingAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true)>]
type WebServiceBindingAttribute = class
    inherit Attribute
Public NotInheritable Class WebServiceBindingAttribute
Inherits Attribute
継承
WebServiceBindingAttribute
属性

次の XML Web サービスは、4 つのバインディングからの操作を実装します。 具体的には、XML Web サービスは、XML Web サービスに 3 つの属性を適用することで、操作を実装する 3 つの WebServiceBindingAttribute バインドを宣言します。

操作を実装する XML Web サービス メソッドのバインドを指定するには、 SoapDocumentMethodAttribute を除く DefaultBindingMethod各 XML Web サービス メソッドに が適用されます。 にバインド DefaultBindingMethodを指定しないことで、XML Web サービスの既定のバインドに対する操作が実装されます。

<%@ 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

注釈

Web サービス記述言語 (WSDL) で定義されているバインディングは、具体的な操作セットを定義するという点で、インターフェイスに似ています。 各 XML Web サービス メソッドは、特定のバインディング内の操作です。 XML Web サービス メソッドは、XML Web サービスの既定のバインド、または XML Web サービスを実装するクラスに適用される 内で WebServiceBindingAttribute 指定されたバインディングのメンバーです。 XML Web サービスは、XML Web サービスに複数の属性を適用することで、複数 WebServiceBindingAttribute のバインディングを実装できます。

1 つ以上 WebServiceAttribute の属性が XML Web サービスに適用されると、 SoapDocumentMethodAttribute または SoapRpcMethodAttribute を個々の XML Web サービス メソッドに適用して、特定の XML Web サービス メソッドによって実装されるバインド操作を示すことができます。 または SoapRpcMethodAttributeSoapDocumentMethodAttribute プロパティをBinding設定して、XML Web サービス メソッドが操作を実装するバインドを指定します。

コンストラクター

WebServiceBindingAttribute()

WebServiceBindingAttribute クラスの新しいインスタンスを初期化します。

WebServiceBindingAttribute(String)

XML Web サービス メソッドが実装しているバインディングの名前を設定する WebServiceBindingAttribute クラスの新しいインスタンスを初期化します。

WebServiceBindingAttribute(String, String)

WebServiceBindingAttribute クラスの新しいインスタンスを初期化します。

WebServiceBindingAttribute(String, String, String)

WebServiceBindingAttribute クラスの新しいインスタンスを初期化します。

プロパティ

ConformsTo

バインディングが準拠していることを示す Web Services Interoperability (WSI) 仕様を取得または設定します。

EmitConformanceClaims

バインディングが準拠の表示を出力するかどうかを示す値を取得または設定します。

Location

バインディングが定義されている場所を取得または設定します。

Name

バインディングの名前を取得または設定します。

Namespace

バインディングに関連付けられている名前空間を取得または設定します。

TypeId

派生クラスで実装されると、この Attribute の一意の識別子を取得します。

(継承元 Attribute)

メソッド

Equals(Object)

このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。

(継承元 Attribute)
GetHashCode()

このインスタンスのハッシュ コードを返します。

(継承元 Attribute)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsDefaultAttribute()

派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。

(継承元 Attribute)
Match(Object)

派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。

(継承元 Attribute)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

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

一連の名前を対応する一連のディスパッチ識別子に割り当てます。

(継承元 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。

(継承元 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。

(継承元 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。

(継承元 Attribute)

適用対象

こちらもご覧ください