This documentation is archived and is not being maintained.

OperationMessage Class

Represents a message type passed by the action of an XML Web service.

Namespace:  System.Web.Services.Description
Assembly:  System.Web.Services (in System.Web.Services.dll)

public abstract class OperationMessage : NamedItem

This class serves as the base class for the following classes:

using System;
using System.Xml;
using System.Web.Services;
using System.Web.Services.Description;

class MyOperationMessageSample
{
   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;

         OperationMessage myInputOperationMessage =
            (OperationMessage) new OperationInput();
         XmlQualifiedName myXmlQualifiedName = new XmlQualifiedName(
            "AddSoapIn", myDescription.TargetNamespace);
         myInputOperationMessage.Message = myXmlQualifiedName;
         myOperationMessageCollection.Insert(0, myInputOperationMessage);

         // Display the operation name of the InputMessage.
         Console.WriteLine("The operation name is " + 
            myInputOperationMessage.Operation.Name);

         // Add the OperationMessage to the collection.
         myDescription.Write("MathService_new_cs.wsdl");
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception caught!!!");
         Console.WriteLine("Source : " + e.Source);
         Console.WriteLine("Message : " + e.Message);
      }
   }
}
#using <mscorlib.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;

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

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

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

      OperationMessage* myInputOperationMessage =
         dynamic_cast<OperationMessage*> (new OperationInput());
      XmlQualifiedName* myXmlQualifiedName = new XmlQualifiedName(
         S"AddSoapIn", myDescription->TargetNamespace);
      myInputOperationMessage->Message = myXmlQualifiedName;
      myOperationMessageCollection->Insert(0, myInputOperationMessage);

      // Display the operation name of the InputMessage.
      Console::WriteLine(S"The operation name is {0}", myInputOperationMessage->Operation->Name);

      // Add the OperationMessage to the collection.
      myDescription->Write(S"MathService_new_cs.wsdl");
   }
   catch(Exception* e)
   {
      Console::WriteLine(S"Exception caught!!!");
      Console::WriteLine(S"Source : {0}", e->Source);
      Console::WriteLine(S"Message : {0}", e->Message);
   }
}

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Show: