次の方法で共有


OperationMessage クラス

XML Web サービスのアクションによって渡されるメッセージの種類を表します。

この型のすべてのメンバの一覧については、OperationMessage メンバ を参照してください。

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

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

スレッドセーフ

この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。

解説

このクラスは、次のクラスの基本クラスとして機能します。

使用例

 
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] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

名前空間: System.Web.Services.Description

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

アセンブリ: System.Web.Services (System.Web.Services.dll 内)

参照

OperationMessage メンバ | System.Web.Services.Description 名前空間