Compartir por


OperationMessageCollection Clase

Definición

Representa una colección de OperationInput mensajes y OperationOutput relacionados con un servicio web XML. Esta clase no puede heredarse.

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
Herencia

Ejemplos

#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 ))
      {
         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))
         {
            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

Comentarios

La propiedad del elemento primario Operationdevolverá Messages una instancia de esta clase. Por lo tanto, puede tener exactamente dos miembros, uno y OperationInput otro .OperationOutput

Propiedades

Nombre Description
Capacity

Obtiene o establece el número de elementos que CollectionBase puede contener.

(Heredado de CollectionBase)
Count

Obtiene el número de elementos contenidos en la CollectionBase instancia. Esta propiedad no se puede invalidar.

(Heredado de CollectionBase)
Flow

Obtiene el tipo de transmisión admitido por .OperationMessageCollection

InnerList

Obtiene un ArrayList objeto que contiene la lista de elementos de la CollectionBase instancia de .

(Heredado de CollectionBase)
Input

Obtiene la primera aparición de un objeto OperationInput dentro de la colección.

Item[Int32]

Obtiene o establece el valor de en OperationMessage el índice de base cero especificado.

List

Obtiene un IList objeto que contiene la lista de elementos de la CollectionBase instancia de .

(Heredado de CollectionBase)
Output

Obtiene la primera aparición de un objeto OperationOutput dentro de la colección.

Table

Obtiene una interfaz que implementa la asociación de las claves y los valores de .ServiceDescriptionBaseCollection

(Heredado de ServiceDescriptionBaseCollection)

Métodos

Nombre Description
Add(OperationMessage)

Agrega el objeto especificado OperationMessage al final de .OperationMessageCollection

Clear()

Quita todos los objetos de la CollectionBase instancia. Este método no se puede invalidar.

(Heredado de CollectionBase)
Contains(OperationMessage)

Determina si el objeto especificado OperationMessage es un miembro de .OperationMessageCollection

CopyTo(OperationMessage[], Int32)

Copia todo en OperationMessageCollection una matriz unidimensional compatible de tipo OperationMessage, empezando por el índice de base cero especificado de la matriz de destino.

Equals(Object)

Determina si el objeto especificado es igual al objeto actual.

(Heredado de Object)
GetEnumerator()

Devuelve un enumerador que recorre en iteración la CollectionBase instancia de .

(Heredado de CollectionBase)
GetHashCode()

Actúa como función hash predeterminada.

(Heredado de Object)
GetKey(Object)

Devuelve el nombre de la clave asociada al valor pasado por referencia.

(Heredado de ServiceDescriptionBaseCollection)
GetType()

Obtiene el Type de la instancia actual.

(Heredado de Object)
IndexOf(OperationMessage)

Busca el especificado OperationMessage y devuelve el índice de base cero de la primera aparición dentro de la colección.

Insert(Int32, OperationMessage)

Agrega el objeto especificado OperationMessage al OperationMessageCollection objeto en el índice de base cero especificado.

MemberwiseClone()

Crea una copia superficial del Objectactual.

(Heredado de Object)
OnClear()

Borra el contenido de la instancia de ServiceDescriptionBaseCollection.

(Heredado de ServiceDescriptionBaseCollection)
OnClearComplete()

Realiza procesos personalizados adicionales después de borrar el contenido de la CollectionBase instancia.

(Heredado de CollectionBase)
OnInsert(Int32, Object)

Realiza procesos personalizados adicionales antes de insertar un nuevo elemento en la CollectionBase instancia.

(Heredado de CollectionBase)
OnInsertComplete(Int32, Object)

Realiza procesos personalizados adicionales después de insertar un nuevo elemento en .ServiceDescriptionBaseCollection

(Heredado de ServiceDescriptionBaseCollection)
OnRemove(Int32, Object)

Quita un elemento de .ServiceDescriptionBaseCollection

(Heredado de ServiceDescriptionBaseCollection)
OnRemoveComplete(Int32, Object)

Realiza procesos personalizados adicionales después de quitar un elemento de la CollectionBase instancia.

(Heredado de CollectionBase)
OnSet(Int32, Object, Object)

Reemplaza un valor por otro dentro de ServiceDescriptionBaseCollection.

(Heredado de ServiceDescriptionBaseCollection)
OnSetComplete(Int32, Object, Object)

Realiza procesos personalizados adicionales después de establecer un valor en la CollectionBase instancia de .

(Heredado de CollectionBase)
OnValidate(Object)

Realiza procesos personalizados adicionales al validar un valor.

(Heredado de CollectionBase)
Remove(OperationMessage)

Quita la primera aparición del especificado OperationMessage de .OperationMessageCollection

RemoveAt(Int32)

Quita el elemento en el índice especificado de la CollectionBase instancia. Este método no se puede invalidar.

(Heredado de CollectionBase)
SetParent(Object, Object)

Establece el objeto primario de la ServiceDescriptionBaseCollection instancia.

(Heredado de ServiceDescriptionBaseCollection)
ToString()

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Implementaciones de interfaz explícitas

Nombre Description
ICollection.CopyTo(Array, Int32)

Copia todo en CollectionBase una unidimensional Arraycompatible, empezando por el índice especificado de la matriz de destino.

(Heredado de CollectionBase)
ICollection.IsSynchronized

Obtiene un valor que indica si el acceso a la CollectionBase está sincronizado (seguro para subprocesos).

(Heredado de CollectionBase)
ICollection.SyncRoot

Obtiene un objeto que se puede usar para sincronizar el acceso a .CollectionBase

(Heredado de CollectionBase)
IList.Add(Object)

Agrega un objeto al final de .CollectionBase

(Heredado de CollectionBase)
IList.Contains(Object)

Determina si contiene CollectionBase un elemento específico.

(Heredado de CollectionBase)
IList.IndexOf(Object)

Busca el especificado Object y devuelve el índice de base cero de la primera aparición dentro de todo CollectionBase.

(Heredado de CollectionBase)
IList.Insert(Int32, Object)

Inserta un elemento en en el CollectionBase índice especificado.

(Heredado de CollectionBase)
IList.IsFixedSize

Obtiene un valor que indica si CollectionBase tiene un tamaño fijo.

(Heredado de CollectionBase)
IList.IsReadOnly

Obtiene un valor que indica si el CollectionBase es de solo lectura.

(Heredado de CollectionBase)
IList.Item[Int32]

Obtiene o establece el elemento en el índice especificado.

(Heredado de CollectionBase)
IList.Remove(Object)

Quita la primera aparición de un objeto específico de .CollectionBase

(Heredado de CollectionBase)

Métodos de extensión

Nombre Description
AsParallel(IEnumerable)

Habilita la paralelización de una consulta.

AsQueryable(IEnumerable)

Convierte un IEnumerable en un IQueryable.

Cast<TResult>(IEnumerable)

Convierte los elementos de un IEnumerable al tipo especificado.

OfType<TResult>(IEnumerable)

Filtra los elementos de un IEnumerable en función de un tipo especificado.

Se aplica a