Export (0) Print
Expand All

OperationMessage Class

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

For a list of all members of this type, see OperationMessage Members.

System.Object
   System.Web.Services.Description.DocumentableItem
      System.Web.Services.Description.OperationMessage
         System.Web.Services.Description.OperationFault
         System.Web.Services.Description.OperationInput
         System.Web.Services.Description.OperationOutput

[Visual Basic]
MustInherit Public Class OperationMessage
   Inherits DocumentableItem
[C#]
public abstract class OperationMessage : DocumentableItem
[C++]
public __gc __abstract class OperationMessage : public
   DocumentableItem
[JScript]
public abstract class OperationMessage extends DocumentableItem

Thread Safety

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

Remarks

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

Example

[Visual Basic] 
Imports System
Imports System.Xml
Imports System.Web.Services
Imports System.Web.Services.Description

Class MyOperationMessageSample

   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

         Dim myInputOperationMessage As OperationMessage = _
            CType(New OperationInput(), OperationMessage)
         Dim myXmlQualifiedName As 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_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
End Class 'MyOperationMessageSample

[C#] 
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);
      }
   }
}

[C++] 
#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);
   }
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Web.Services.Description

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

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

See Also

OperationMessage Members | System.Web.Services.Description Namespace

Show:
© 2014 Microsoft