OperationBinding クラス

定義

XML Web サービスでサポートされているアクションで使用するメッセージのための、プロトコルとデータ形式の仕様を提供します。 このクラスは継承できません。

public ref class OperationBinding sealed : System::Web::Services::Description::DocumentableItem
public ref class OperationBinding sealed : System::Web::Services::Description::NamedItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class OperationBinding : System.Web.Services.Description.DocumentableItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class OperationBinding : System.Web.Services.Description.NamedItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type OperationBinding = class
    inherit DocumentableItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type OperationBinding = class
    inherit NamedItem
Public NotInheritable Class OperationBinding
Inherits DocumentableItem
Public NotInheritable Class OperationBinding
Inherits NamedItem
継承
OperationBinding
継承
OperationBinding
属性

次の例では、 クラスによって公開されるプロパティとメソッドの使用方法を OperationBinding 示します。 既存 ServiceDescription のものを受け取り、SOAP プロトコルのサポートを追加します。

#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>

using namespace System;
using namespace System::Web::Services::Description;

int main()
{
   try
   {
      ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input_cs.wsdl" );
      String^ myTargetNamespace = myServiceDescription->TargetNamespace;
      
      // Create an OperationBinding for the Add operation.
      OperationBinding^ addOperationBinding = gcnew OperationBinding;
      String^ addOperation = "Add";
      addOperationBinding->Name = addOperation;

      // Create an InputBinding for the Add operation.
      InputBinding^ myInputBinding = gcnew InputBinding;
      SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding;
      mySoapBodyBinding->Use = SoapBindingUse::Literal;
      myInputBinding->Extensions->Add( mySoapBodyBinding );

      // Add the InputBinding to the OperationBinding.
      addOperationBinding->Input = myInputBinding;

      // Create an OutputBinding for the Add operation.
      OutputBinding^ myOutputBinding = gcnew OutputBinding;
      myOutputBinding->Extensions->Add( mySoapBodyBinding );
      
      // Add the OutputBinding to the OperationBinding. 
      addOperationBinding->Output = myOutputBinding;

      // Create an extensibility element for a SoapOperationBinding.
      SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding;
      mySoapOperationBinding->Style = SoapBindingStyle::Document;
      mySoapOperationBinding->SoapAction = String::Concat( myTargetNamespace, addOperation );

      // Add the extensibility element SoapOperationBinding to 
      // the OperationBinding.
      addOperationBinding->Extensions->Add( mySoapOperationBinding );

      ServiceDescriptionFormatExtensionCollection^ myExtensions;

      // Get the FaultBindingCollection from the OperationBinding.
      FaultBindingCollection^ myFaultBindingCollection = addOperationBinding->Faults;
      FaultBinding^ myFaultBinding = gcnew FaultBinding;
      myFaultBinding->Name = "ErrorFloat";

      // Associate SOAP fault binding to the fault binding of the operation.
      myExtensions = myFaultBinding->Extensions;
      SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding;
      mySoapFaultBinding->Use = SoapBindingUse::Literal;
      mySoapFaultBinding->Namespace = myTargetNamespace;
      myExtensions->Add( mySoapFaultBinding );
      myFaultBindingCollection->Add( myFaultBinding );

      // Get the BindingCollection from the ServiceDescription.
      BindingCollection^ myBindingCollection = myServiceDescription->Bindings;

      // Get the OperationBindingCollection of SOAP binding 
      // from the BindingCollection.
      OperationBindingCollection^ myOperationBindingCollection = myBindingCollection[ 0 ]->Operations;
      myOperationBindingCollection->Add( addOperationBinding );
      Console::WriteLine( "The operations supported by this service are:" );
      System::Collections::IEnumerator^ myEnum = myOperationBindingCollection->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         OperationBinding^ myOperationBinding = safe_cast<OperationBinding^>(myEnum->Current);

         Binding^ myBinding = myOperationBinding->Binding;
         Console::WriteLine( " Binding : {0} :: Name of operation : {1}", myBinding->Name, myOperationBinding->Name );

         FaultBindingCollection^ myFaultBindingCollection1 = myOperationBinding->Faults;
         System::Collections::IEnumerator^ myEnum1 = myFaultBindingCollection1->GetEnumerator();
         while ( myEnum1->MoveNext() )
         {
            FaultBinding^ myFaultBinding1 = safe_cast<FaultBinding^>(myEnum1->Current);
            Console::WriteLine( "    Fault : {0}", myFaultBinding1->Name );
         }
      }
      myServiceDescription->Write( "MathService_new_cs.wsdl" );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception caught!!!" );
      Console::WriteLine( "Source : {0}", e->Source );
      Console::WriteLine( "Message : {0}", e->Message );
   }
}
using System;
using System.Web.Services.Description;

class MyOperationBindingSample
{
   static void Main()
   {
      try
      {
         ServiceDescription myServiceDescription =
            ServiceDescription.Read("MathService_input_cs.wsdl");
         string myTargetNamespace = myServiceDescription.TargetNamespace;

         // Create an OperationBinding for the Add operation.
         OperationBinding addOperationBinding = new OperationBinding();
         string addOperation = "Add";
         addOperationBinding.Name = addOperation;

         // Create an InputBinding for the Add operation.
         InputBinding myInputBinding = new InputBinding();
         SoapBodyBinding mySoapBodyBinding = new SoapBodyBinding();
         mySoapBodyBinding.Use = SoapBindingUse.Literal;
         myInputBinding.Extensions.Add(mySoapBodyBinding);

         // Add the InputBinding to the OperationBinding.
         addOperationBinding.Input = myInputBinding;

         // Create an OutputBinding for the Add operation.
         OutputBinding myOutputBinding = new OutputBinding();
         myOutputBinding.Extensions.Add(mySoapBodyBinding);

         // Add the OutputBinding to the OperationBinding.
         addOperationBinding.Output = myOutputBinding;

         // Create an extensibility element for a SoapOperationBinding.
         SoapOperationBinding mySoapOperationBinding =
            new SoapOperationBinding();
         mySoapOperationBinding.Style = SoapBindingStyle.Document;
         mySoapOperationBinding.SoapAction = myTargetNamespace + addOperation;

         // Add the extensibility element SoapOperationBinding to
         // the OperationBinding.
         addOperationBinding.Extensions.Add(mySoapOperationBinding);

         ServiceDescriptionFormatExtensionCollection myExtensions;

         // Get the FaultBindingCollection from the OperationBinding.
         FaultBindingCollection myFaultBindingCollection =
            addOperationBinding.Faults;
         FaultBinding myFaultBinding = new FaultBinding();
         myFaultBinding.Name = "ErrorFloat";

         // Associate SOAP fault binding to the fault binding of the operation.
         myExtensions = myFaultBinding.Extensions;
         SoapFaultBinding mySoapFaultBinding = new SoapFaultBinding();
         mySoapFaultBinding.Use = SoapBindingUse.Literal;
         mySoapFaultBinding.Namespace = myTargetNamespace;
         myExtensions.Add(mySoapFaultBinding);
         myFaultBindingCollection.Add(myFaultBinding);

         // Get the BindingCollection from the ServiceDescription.
         BindingCollection myBindingCollection =
            myServiceDescription.Bindings;

         // Get the OperationBindingCollection of SOAP binding
         // from the BindingCollection.
         OperationBindingCollection myOperationBindingCollection =
            myBindingCollection[0].Operations;
         myOperationBindingCollection.Add(addOperationBinding);

         Console.WriteLine(
            "The operations supported by this service are:");
         foreach(OperationBinding myOperationBinding in
            myOperationBindingCollection)
         {
            Binding myBinding = myOperationBinding.Binding;
            Console.WriteLine(" Binding : " + myBinding.Name +
               " :: Name of operation : " + myOperationBinding.Name);
            FaultBindingCollection myFaultBindingCollection1 =
               myOperationBinding.Faults;
            foreach(FaultBinding myFaultBinding1 in
               myFaultBindingCollection1)
            {
                 Console.WriteLine("    Fault : " + myFaultBinding1.Name);
            }
         }
         // Save the ServiceDescription to an external file.
         myServiceDescription.Write("MathService_new_cs.wsdl");
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception caught!!!");
         Console.WriteLine("Source : " + e.Source);
         Console.WriteLine("Message : " + e.Message);
      }
   }
}
Imports System.Web.Services.Description

Class MyOperationBindingSample

   Shared Sub Main()
      Try
         Dim myServiceDescription As ServiceDescription = _
            ServiceDescription.Read("MathService_input_vb.wsdl")
         Dim myTargetNamespace As String = _
            myServiceDescription.TargetNamespace

         ' Create an OperationBinding for the Add operation.
         Dim addOperationBinding As New OperationBinding()
         Dim addOperation As String = "Add"
         addOperationBinding.Name = addOperation

         ' Create an InputBinding for the Add operation.
         Dim myInputBinding As New InputBinding()
         Dim mySoapBodyBinding As New SoapBodyBinding()
         mySoapBodyBinding.Use = SoapBindingUse.Literal
         myInputBinding.Extensions.Add(mySoapBodyBinding)

         ' Add the InputBinding to the OperationBinding.
         addOperationBinding.Input = myInputBinding

         ' Create an OutputBinding for the Add operation.
         Dim myOutputBinding As New OutputBinding()
         myOutputBinding.Extensions.Add(mySoapBodyBinding)

         ' Add the OutputBinding to the OperationBinding.
         addOperationBinding.Output = myOutputBinding

         ' Create an extensibility element for a SoapOperationBinding.
         Dim mySoapOperationBinding As New SoapOperationBinding()
         mySoapOperationBinding.Style = SoapBindingStyle.Document
         mySoapOperationBinding.SoapAction = myTargetNamespace & addOperation

         ' Add the extensibility element SoapOperationBinding to 
         ' the OperationBinding.
         addOperationBinding.Extensions.Add(mySoapOperationBinding)

         Dim myExtensions As ServiceDescriptionFormatExtensionCollection

         ' Get the FaultBindingCollection from the OperationBinding.
         Dim myFaultBindingCollection As FaultBindingCollection = _
            addOperationBinding.Faults
         Dim myFaultBinding As New FaultBinding()
         myFaultBinding.Name = "ErrorFloat"

         ' Associate SOAP fault binding to the fault binding of the operation.
         myExtensions = myFaultBinding.Extensions
         Dim mySoapFaultBinding As New SoapFaultBinding()
         mySoapFaultBinding.Use = SoapBindingUse.Literal
         mySoapFaultBinding.Namespace = myTargetNamespace
         myExtensions.Add(mySoapFaultBinding)
         myFaultBindingCollection.Add(myFaultBinding)

         ' Get the BindingCollection from the ServiceDescription.
         Dim myBindingCollection As BindingCollection = _
            myServiceDescription.Bindings

         ' Get the OperationBindingCollection of SOAP binding 
         ' from the BindingCollection.
         Dim myOperationBindingCollection As OperationBindingCollection = _
            myBindingCollection(0).Operations
         myOperationBindingCollection.Add(addOperationBinding)

         Console.WriteLine( _
            "The operations supported by this service are:")
         Dim myOperationBinding As OperationBinding
         For Each myOperationBinding In  myOperationBindingCollection
            Dim myBinding As Binding = myOperationBinding.Binding
            Console.WriteLine(" Binding : " & myBinding.Name & _
               " :: Name of operation : " & myOperationBinding.Name)
            Dim myFaultBindingCollection1 As FaultBindingCollection = _
               myOperationBinding.Faults
            Dim myFaultBinding1 As FaultBinding
            For Each myFaultBinding1 In myFaultBindingCollection1
               Console.WriteLine("    Fault : " & myFaultBinding1.Name)
            Next myFaultBinding1
         Next myOperationBinding

         ' Save the ServiceDescripition to an external file.
         myServiceDescription.Write("MathService_new_vb.wsdl")
      Catch e As Exception
         Console.WriteLine("Exception caught!!!")
         Console.WriteLine("Source : " & e.Source.ToString())
         Console.WriteLine("Message : " & e.Message.ToString())
      End Try
   End Sub
End Class

注釈

クラスはOperationBinding、 要素で<binding>囲まれた Web サービス記述言語 (WSDL) <operation> 要素に対応します。この要素は、 クラスにBinding対応します。 WSDL の詳細については、WSDL 仕様を参照してください。

コンストラクター

OperationBinding()

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

プロパティ

Binding

現在の Binding がメンバーとして含まれている OperationBinding を取得します。

Documentation

DocumentableItem のインスタンスのテキスト ドキュメントを取得または設定します。

(継承元 DocumentableItem)
DocumentationElement

DocumentableItem のドキュメント要素を取得または設定します。

(継承元 DocumentableItem)
ExtensibleAttributes

Web Services Interoperability (WS-I) Basic Profile 1.1 に準拠する WSDL の属性の拡張機能を表す XmlAttribute 型の配列を取得または設定します。

(継承元 DocumentableItem)
Extensions

現在の OperationBinding に固有の機能拡張要素コレクションを取得します。

Faults

FaultBindingCollection インスタンスに関連付けられた OperationBinding を取得します。

Input

InputBinding に関連付けられている OperationBinding を取得または設定します。

Name

OperationBinding の名前を取得または設定します。

Name

項目の名前を取得または設定します。

(継承元 NamedItem)
Namespaces

ServiceDescription オブジェクトが生成されるときに名前空間プレフィックスと名前空間を保持するために使用する、名前空間プレフィックスと名前空間のディクショナリを取得または設定します。

(継承元 DocumentableItem)
Output

OutputBinding に関連付けられている OperationBinding を取得または設定します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

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

(継承元 Object)
MemberwiseClone()

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

(継承元 Object)
ToString()

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

(継承元 Object)

適用対象