OperationMessageCollection クラス

定義

XML Web サービスに関連する OperationInput メッセージと OperationOutput メッセージのコレクションを表します。 このクラスは継承できません。

public ref class OperationMessageCollection sealed : System::Web::Services::Description::ServiceDescriptionBaseCollection
public sealed class OperationMessageCollection : System.Web.Services.Description.ServiceDescriptionBaseCollection
type OperationMessageCollection = class
    inherit ServiceDescriptionBaseCollection
Public NotInheritable Class OperationMessageCollection
Inherits ServiceDescriptionBaseCollection
継承

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

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

// Displays the properties of the OperationMessageCollection.
void DisplayFlowInputOutput( OperationMessageCollection^ myOperationMessageCollection, String^ myOperation )
{
   Console::WriteLine( "After {0}:", myOperation );
   Console::WriteLine( "Flow : {0}", myOperationMessageCollection->Flow );
   Console::WriteLine( "The first occurrence of operation Input in the collection {0}", myOperationMessageCollection->Input );
   Console::WriteLine( "The first occurrence of operation Output in the collection {0}", myOperationMessageCollection->Output );
   Console::WriteLine();
}

int main()
{
   try
   {
      ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_input_cs.wsdl" );
      PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes;

      // Get the OperationCollection for the SOAP protocol.
      OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations;

      // Get the OperationMessageCollection for the Add operation.
      OperationMessageCollection^ myOperationMessageCollection = myOperationCollection[ 0 ]->Messages;

      // Display the Flow, Input, and Output properties.
      DisplayFlowInputOutput( myOperationMessageCollection, "Start" );

      // Get the operation message for the Add operation.
      OperationMessage^ myOperationMessage = myOperationMessageCollection[ 0 ];
      OperationMessage^ myInputOperationMessage = dynamic_cast<OperationMessage^>(gcnew OperationInput);
      XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace );
      myInputOperationMessage->Message = myXmlQualifiedName;

      array<OperationMessage^>^myCollection = gcnew array<OperationMessage^>(myOperationMessageCollection->Count);
      myOperationMessageCollection->CopyTo( myCollection, 0 );
      Console::WriteLine( "Operation name(s) :" );
      for ( int i = 0; i < myCollection->Length; i++ )
      {
         Console::WriteLine( " {0}", myCollection[ i ]->Operation->Name );
      }

      // Add the OperationMessage to the collection.
      myOperationMessageCollection->Add( myInputOperationMessage );
      
      DisplayFlowInputOutput( myOperationMessageCollection, "Add" );
      
      if ( myOperationMessageCollection->Contains( myOperationMessage ) == true )
      {
         int myIndex = myOperationMessageCollection->IndexOf( myOperationMessage );
         Console::WriteLine( " The index of the Add operation message in the collection is : {0}", myIndex );
      }

      myOperationMessageCollection->Remove( myInputOperationMessage );

      // Display Flow, Input, and Output after removing.
      DisplayFlowInputOutput( myOperationMessageCollection, "Remove" );

      // Insert the message at index 0 in the collection.
      myOperationMessageCollection->Insert( 0, myInputOperationMessage );

      // Display Flow, Input, and Output after inserting.
      DisplayFlowInputOutput( myOperationMessageCollection, "Insert" );

      myDescription->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.Xml;
using System.Web.Services;
using System.Web.Services.Description;

class MyOperationMessageCollectionSample
{
   static void Main()
   {
      try
      {
         ServiceDescription myDescription =
            ServiceDescription.Read("MathService_input_cs.wsdl");
         PortTypeCollection myPortTypeCollection  =
            myDescription.PortTypes;

         // Get the OperationCollection for the SOAP protocol.
         OperationCollection myOperationCollection =
            myPortTypeCollection[0].Operations;

         // Get the OperationMessageCollection for the Add operation.
         OperationMessageCollection myOperationMessageCollection =
            myOperationCollection[0].Messages;

         // Display the Flow, Input, and Output properties.
         DisplayFlowInputOutput(myOperationMessageCollection, "Start");

         // Get the operation message for the Add operation.
         OperationMessage myOperationMessage =
            myOperationMessageCollection[0];
         OperationMessage myInputOperationMessage =
            (OperationMessage) new OperationInput();
         XmlQualifiedName myXmlQualifiedName = new XmlQualifiedName(
            "AddSoapIn", myDescription.TargetNamespace);
         myInputOperationMessage.Message = myXmlQualifiedName;

         OperationMessage[] myCollection =
            new OperationMessage[myOperationMessageCollection.Count];
         myOperationMessageCollection.CopyTo(myCollection, 0);
         Console.WriteLine("Operation name(s) :");
         for (int i = 0; i < myCollection.Length ; i++)
         {
            Console.WriteLine(" " + myCollection[i].Operation.Name);
         }

         // Add the OperationMessage to the collection.
         myOperationMessageCollection.Add(myInputOperationMessage);
         DisplayFlowInputOutput(myOperationMessageCollection, "Add");

         if(myOperationMessageCollection.Contains(myOperationMessage)
            == true )
         {
            int myIndex =
               myOperationMessageCollection.IndexOf(myOperationMessage);
            Console.WriteLine(" The index of the Add operation " +
               "message in the collection is : " + myIndex);
         }

         myOperationMessageCollection.Remove(myInputOperationMessage);

         // Display Flow, Input, and Output after removing.
         DisplayFlowInputOutput(myOperationMessageCollection, "Remove");

         // Insert the message at index 0 in the collection.
         myOperationMessageCollection.Insert(0, myInputOperationMessage);

         // Display Flow, Input, and Output after inserting.
         DisplayFlowInputOutput(myOperationMessageCollection, "Insert");

         myDescription.Write("MathService_new_cs.wsdl");
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception caught!!!");
         Console.WriteLine("Source : " + e.Source);
         Console.WriteLine("Message : " + e.Message);
      }
   }

   // Displays the properties of the OperationMessageCollection.
   public static void DisplayFlowInputOutput( OperationMessageCollection
      myOperationMessageCollection, string myOperation)
   {
      Console.WriteLine("After " + myOperation + ":");
      Console.WriteLine("Flow : " + myOperationMessageCollection.Flow);
      Console.WriteLine("The first occurrence of operation Input " +
         "in the collection " + myOperationMessageCollection.Input);
      Console.WriteLine("The first occurrence of operation Output " +
         "in the collection " + myOperationMessageCollection.Output);
      Console.WriteLine();
   }
}
Imports System.Xml
Imports System.Web.Services
Imports System.Web.Services.Description

Class MyOperationMessageCollectionSample
   
   Shared Sub Main()
      Try
         Dim myDescription As ServiceDescription = _
            ServiceDescription.Read("MathService_input_vb.wsdl")
         Dim myPortTypeCollection As PortTypeCollection = _
            myDescription.PortTypes

         ' Get the OperationCollection for the SOAP protocol.
         Dim myOperationCollection As OperationCollection = _
            myPortTypeCollection(0).Operations

         ' Get the OperationMessageCollection for the Add operation.
         Dim myOperationMessageCollection As OperationMessageCollection = _
            myOperationCollection(0).Messages
         ' Display the Flow, Input, and Output properties.
         DisplayFlowInputOutput(myOperationMessageCollection, "Start")

         ' Get the operation message for the Add operation.
         Dim myOperationMessage As OperationMessage = _
            myOperationMessageCollection.Item(0)
         Dim myInputOperationMessage As OperationMessage = _
            CType(New OperationInput(), OperationMessage)
         Dim myXmlQualifiedName As _
            New XmlQualifiedName("AddSoapIn", myDescription.TargetNamespace)
         myInputOperationMessage.Message = myXmlQualifiedName
         
         Dim myCollection(myOperationMessageCollection.Count -1 ) _
            As OperationMessage
         myOperationMessageCollection.CopyTo(myCollection, 0)
         Console.WriteLine("Operation name(s) :")
         Dim i As Integer
         For i = 0 To myCollection.Length - 1
            Console.WriteLine(" " & myCollection(i).Operation.Name)
         Next i

         ' Add the OperationMessage to the collection.
         myOperationMessageCollection.Add(myInputOperationMessage)
         DisplayFlowInputOutput(myOperationMessageCollection, "Add")
         
         If myOperationMessageCollection.Contains(myOperationMessage) _
            = True Then
            Dim myIndex As Integer = _
               myOperationMessageCollection.IndexOf(myOperationMessage)
            Console.WriteLine(" The index of the Add operation " & _
                "message in the collection is : " & myIndex.ToString())
         End If

         myOperationMessageCollection.Remove(myInputOperationMessage)

         ' Display Flow, Input, and Output after removing.
         DisplayFlowInputOutput(myOperationMessageCollection, "Remove")

         ' Insert the message at index 0 in the collection.
         myOperationMessageCollection.Insert(0, myInputOperationMessage)

         ' Display Flow, Input, and Output after inserting.
         DisplayFlowInputOutput(myOperationMessageCollection, "Insert")

         myDescription.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
   
   ' Displays the properties of the OperationMessageCollection.
   Public Shared Sub DisplayFlowInputOutput(myOperationMessageCollection As  _
      OperationMessageCollection, myOperation As String)

      Console.WriteLine("After " & myOperation.ToString() & ":")
      Console.WriteLine("Flow : " & _
         myOperationMessageCollection.Flow.ToString())
      Console.WriteLine("The first occurrence of operation Input " & _
         "in the collection {0}" , myOperationMessageCollection.Input)
      Console.WriteLine("The first occurrence of operation Output " & _
         "in the collection " &  myOperationMessageCollection.Output.ToString())
      Console.WriteLine()
   End Sub
End Class

注釈

このクラスのインスタンスは、親 OperationMessages プロパティによって返されます。 そのため、2 つのメンバー (1 つは と OperationInput もう 1 つは を含む) を OperationOutput持つことができます。

プロパティ

Capacity

CollectionBase に格納できる要素の数を取得または設定します。

(継承元 CollectionBase)
Count

CollectionBase インスタンスに含まれる要素の数を取得します。 このプロパティはオーバーライドできません。

(継承元 CollectionBase)
Flow

OperationMessageCollection でサポートされる伝送の種類を取得します。

InnerList

ArrayList インスタンス内の要素のリストを格納する CollectionBase を取得します。

(継承元 CollectionBase)
Input

コレクション内の最初に出現する OperationInput を取得します。

Item[Int32]

指定した 0 から始まるインデックス番号にある OperationMessage の値を取得または設定します。

List

IList インスタンス内の要素のリストを格納する CollectionBase を取得します。

(継承元 CollectionBase)
Output

コレクション内の最初に出現する OperationOutput を取得します。

Table

ServiceDescriptionBaseCollection 内のキーと値の関連付けを実装するインターフェイスを取得します。

(継承元 ServiceDescriptionBaseCollection)

メソッド

Add(OperationMessage)

指定した OperationMessageOperationMessageCollection の末尾に追加します。

Clear()

CollectionBase インスタンスからすべてのオブジェクトを削除します。 このメソッドはオーバーライドできません。

(継承元 CollectionBase)
Contains(OperationMessage)

指定した OperationMessageOperationMessageCollection のメンバーかどうかを確認します。

CopyTo(OperationMessage[], Int32)

OperationMessageCollection 全体を互換性のある OperationMessage 型の 1 次元配列にコピーします。コピーは、コピー先の配列の、指定した 0 から始まるインデックス番号から開始します。

Equals(Object)

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

(継承元 Object)
GetEnumerator()

CollectionBase インスタンスを反復処理する列挙子を返します。

(継承元 CollectionBase)
GetHashCode()

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

(継承元 Object)
GetKey(Object)

参照によって渡された値に関連付けられているキーの名前を返します。

(継承元 ServiceDescriptionBaseCollection)
GetType()

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

(継承元 Object)
IndexOf(OperationMessage)

指定した OperationMessage を検索し、コレクション内で最初に見つかった位置の 0 から始まるインデックス番号を返します。

Insert(Int32, OperationMessage)

指定した 0 から始まるインデックス番号にある OperationMessage に、指定した OperationMessageCollection を追加します。

MemberwiseClone()

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

(継承元 Object)
OnClear()

ServiceDescriptionBaseCollection インスタンスの内容を消去します。

(継承元 ServiceDescriptionBaseCollection)
OnClearComplete()

CollectionBase インスタンスの内容を消去した後に、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnInsert(Int32, Object)

CollectionBase インスタンスに新しい要素を挿入する前に、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnInsertComplete(Int32, Object)

ServiceDescriptionBaseCollection に新しい要素を挿入した後に、追加のカスタム プロセスを実行します。

(継承元 ServiceDescriptionBaseCollection)
OnRemove(Int32, Object)

ServiceDescriptionBaseCollection から要素を削除します。

(継承元 ServiceDescriptionBaseCollection)
OnRemoveComplete(Int32, Object)

CollectionBase インスタンスから要素を削除した後に、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnSet(Int32, Object, Object)

値を ServiceDescriptionBaseCollection 内の別の値に置き換えます。

(継承元 ServiceDescriptionBaseCollection)
OnSetComplete(Int32, Object, Object)

CollectionBase インスタンスに値を設定した後に、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
OnValidate(Object)

値を検証するときに、追加のカスタム プロセスを実行します。

(継承元 CollectionBase)
Remove(OperationMessage)

OperationMessage 内で最初に見つかった指定の OperationMessageCollection を削除します。

RemoveAt(Int32)

CollectionBase インスタンスの指定したインデックスにある要素を削除します。 このメソッドはオーバーライドできません。

(継承元 CollectionBase)
SetParent(Object, Object)

ServiceDescriptionBaseCollection インスタンスの親オブジェクトを設定します。

(継承元 ServiceDescriptionBaseCollection)
ToString()

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

(継承元 Object)

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

ICollection.CopyTo(Array, Int32)

CollectionBase 全体を互換性のある 1 次元の Array にコピーします。コピー操作は、コピー先の配列の指定したインデックスから始まります。

(継承元 CollectionBase)
ICollection.IsSynchronized

CollectionBase へのアクセスが同期されている (スレッド セーフである) かどうかを示す値を取得します。

(継承元 CollectionBase)
ICollection.SyncRoot

CollectionBase へのアクセスを同期するために使用できるオブジェクトを取得します。

(継承元 CollectionBase)
IList.Add(Object)

CollectionBase の末尾にオブジェクトを追加します。

(継承元 CollectionBase)
IList.Contains(Object)

CollectionBase に特定の要素が格納されているかどうかを判断します。

(継承元 CollectionBase)
IList.IndexOf(Object)

指定した Object を検索し、CollectionBase 全体内で最初に見つかった位置の 0 から始まるインデックスを返します。

(継承元 CollectionBase)
IList.Insert(Int32, Object)

CollectionBase 内の指定したインデックスの位置に要素を挿入します。

(継承元 CollectionBase)
IList.IsFixedSize

CollectionBase が固定サイズかどうかを示す値を取得します。

(継承元 CollectionBase)
IList.IsReadOnly

CollectionBase が読み取り専用かどうかを示す値を取得します。

(継承元 CollectionBase)
IList.Item[Int32]

指定したインデックスにある要素を取得または設定します。

(継承元 CollectionBase)
IList.Remove(Object)

特定のオブジェクトが CollectionBase 内にあるときに、最初に出現したものを削除します。

(継承元 CollectionBase)

拡張メソッド

Cast<TResult>(IEnumerable)

IEnumerable の要素を、指定した型にキャストします。

OfType<TResult>(IEnumerable)

指定された型に基づいて IEnumerable の要素をフィルター処理します。

AsParallel(IEnumerable)

クエリの並列化を有効にします。

AsQueryable(IEnumerable)

IEnumerableIQueryable に変換します。

適用対象