OperationMessageCollection クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > OperationMessageCollection クラスの意味・解説 

OperationMessageCollection クラス

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

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

Public NotInheritable Class
 OperationMessageCollection
    Inherits ServiceDescriptionBaseCollection
Dim instance As OperationMessageCollection
public sealed class OperationMessageCollection
 : ServiceDescriptionBaseCollection
public ref class OperationMessageCollection
 sealed : public ServiceDescriptionBaseCollection
public final class OperationMessageCollection
 extends ServiceDescriptionBaseCollection
public final class OperationMessageCollection
 extends ServiceDescriptionBaseCollection
解説解説

このクラスインスタンスは、親 OperationMessages プロパティから返されます。そのため、ここで持つことができるメンバは、OperationInputOperationOutput2 つだけです。

使用例使用例
Imports System
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 'Main
   
   ' 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 'DisplayFlowInputOutput
End Class 'MyOperationMessageCollectionSample
 
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();
   }
}
#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 );
   }
}
import System.*;
import System.Xml.*;
import System.Web.Services.*;
import System.Web.Services.Description.*;

class MyOperationMessageCollectionSample
{
    public static void main(String[]
 args)
    {
        try {
            ServiceDescription myDescription = ServiceDescription.
                Read("MathService_input_jsl.wsdl");
            PortTypeCollection myPortTypeCollection = myDescription.
                get_PortTypes();
            // Get the OperationCollection for the SOAP protocol.
            OperationCollection myOperationCollection = myPortTypeCollection.
                get_Item(0).get_Operations();
            // Get the OperationMessageCollection for the Add operation.
            OperationMessageCollection myOperationMessageCollection = 
                myOperationCollection.get_Item(0).get_Messages();
            // Display the Flow, Input, and Output properties.
            DisplayFlowInputOutput(myOperationMessageCollection, "Start");
            // Get the operation message for the Add operation.
            OperationMessage myOperationMessage = myOperationMessageCollection.
                get_Item(0);
            OperationMessage myInputOperationMessage = (OperationMessage)
                new OperationInput();
            XmlQualifiedName myXmlQualifiedName = new XmlQualifiedName(
                "AddSoapIn", myDescription.get_TargetNamespace());
            myInputOperationMessage.set_Message(myXmlQualifiedName);
            OperationMessage myCollection[] = 
                new OperationMessage[myOperationMessageCollection.get_Count()];
            myOperationMessageCollection.CopyTo(myCollection, 0);
            Console.WriteLine("Operation name(s) :");
            for (int i = 0; i < myCollection.get_Length();
 i++) {
                Console.WriteLine(" " + myCollection[i].get_Operation().
                    get_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_jsl.wsdl");
        }
        catch (System.Exception e) {
            Console.WriteLine("Exception caught!!!");
            Console.WriteLine("Source : " + e.get_Source());
            Console.WriteLine("Message : " + e.get_Message());
        }
    } //main

    // Displays the properties of the OperationMessageCollection.
    public static void DisplayFlowInputOutput(
        OperationMessageCollection myOperationMessageCollection,
        String myOperation)
    {
        Console.WriteLine("After " + myOperation + ":");
        Console.WriteLine("Flow : " + myOperationMessageCollection.get_Flow());
        Console.WriteLine("The first occurrence of operation Input " 
            + "in the collection " + myOperationMessageCollection.get_Input());
        Console.WriteLine("The first occurrence of operation Output " 
            + "in the collection " + myOperationMessageCollection.get_Output());
        Console.WriteLine();
    } //DisplayFlowInputOutput
} //MyOperationMessageCollectionSample 
継承階層継承階層
System.Object
   System.Collections.CollectionBase
     System.Web.Services.Description.ServiceDescriptionBaseCollection
      System.Web.Services.Description.OperationMessageCollection
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
OperationMessageCollection メンバ
System.Web.Services.Description 名前空間



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「OperationMessageCollection クラス」の関連用語

OperationMessageCollection クラスのお隣キーワード
検索ランキング

   

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



OperationMessageCollection クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS