次の方法で共有


OperationOutput クラス

定義

XML Web サービスから返される出力メッセージの仕様を定義します。 このクラスは継承できません。

public ref class OperationOutput sealed : System::Web::Services::Description::OperationMessage
public sealed class OperationOutput : System.Web.Services.Description.OperationMessage
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class OperationOutput : System.Web.Services.Description.OperationMessage
type OperationOutput = class
    inherit OperationMessage
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type OperationOutput = class
    inherit OperationMessage
Public NotInheritable Class OperationOutput
Inherits OperationMessage
継承
継承
属性

#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>

using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;
using namespace System::Xml;

int main()
{
   try
   {
      ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbersIn_cs.wsdl" );

      // Add the ServiceHttpPost binding.
      Binding^ myBinding = gcnew Binding;
      myBinding->Name = "ServiceHttpPost";
      XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:ServiceHttpPost" );
      myBinding->Type = myXmlQualifiedName;
      HttpBinding^ myHttpBinding = gcnew HttpBinding;
      myHttpBinding->Verb = "POST";
      myBinding->Extensions->Add( myHttpBinding );

      // Add the operation name AddNumbers.
      OperationBinding^ myOperationBinding = gcnew OperationBinding;
      myOperationBinding->Name = "AddNumbers";
      HttpOperationBinding^ myOperation = gcnew HttpOperationBinding;
      myOperation->Location = "/AddNumbers";
      myOperationBinding->Extensions->Add( myOperation );

      // Add the input binding.
      InputBinding^ myInput = gcnew InputBinding;
      MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding;
      postMimeContentbinding->Type = "application/x-www-form-urlencoded";
      myInput->Extensions->Add( postMimeContentbinding );

      // Add the InputBinding to the OperationBinding.
      myOperationBinding->Input = myInput;

      // Add the ouput binding.
      OutputBinding^ myOutput = gcnew OutputBinding;
      MimeXmlBinding^ postMimeXmlbinding = gcnew MimeXmlBinding;
      postMimeXmlbinding->Part = "Body";
      myOutput->Extensions->Add( postMimeXmlbinding );

      // Add the OutPutBinding to the OperationBinding.
      myOperationBinding->Output = myOutput;
      myBinding->Operations->Add( myOperationBinding );
      myDescription->Bindings->Add( myBinding );

      // Add the port definition.
      Port^ postPort = gcnew Port;
      postPort->Name = "ServiceHttpPost";
      postPort->Binding = gcnew XmlQualifiedName( "s0:ServiceHttpPost" );
      HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding;
      postAddressBinding->Location = "http://localhost/Service_cs.asmx";
      postPort->Extensions->Add( postAddressBinding );
      myDescription->Services[ 0 ]->Ports->Add( postPort );

      // Add the post port type definition.
      PortType^ postPortType = gcnew PortType;
      postPortType->Name = "ServiceHttpPost";
      Operation^ postOperation = gcnew Operation;
      postOperation->Name = "AddNumbers";
      OperationMessage^ postInput = dynamic_cast<OperationMessage^>(gcnew OperationInput);
      postInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" );

      OperationOutput^ postOutput = gcnew OperationOutput;
      postOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" );
      postOperation->Messages->Add( postInput );
      postOperation->Messages->Add( postOutput );
      postPortType->Operations->Add( postOperation );

      myDescription->PortTypes->Add( postPortType );

      // Add the first message information.
      Message^ postMessage1 = gcnew Message;
      postMessage1->Name = "AddNumbersHttpPostIn";
      MessagePart^ postMessagePart1 = gcnew MessagePart;
      postMessagePart1->Name = "firstnumber";
      postMessagePart1->Type = gcnew XmlQualifiedName( "s:string" );

      // Add the second message information.
      MessagePart^ postMessagePart2 = gcnew MessagePart;
      postMessagePart2->Name = "secondnumber";
      postMessagePart2->Type = gcnew XmlQualifiedName( "s:string" );
      postMessage1->Parts->Add( postMessagePart1 );
      postMessage1->Parts->Add( postMessagePart2 );
      Message^ postMessage2 = gcnew Message;
      postMessage2->Name = "AddNumbersHttpPostOut";
      
      // Add the third message information.
      MessagePart^ postMessagePart3 = gcnew MessagePart;
      postMessagePart3->Name = "Body";
      postMessagePart3->Element = gcnew XmlQualifiedName( "s0:int" );
      postMessage2->Parts->Add( postMessagePart3 );
      myDescription->Messages->Add( postMessage1 );
      myDescription->Messages->Add( postMessage2 );

      // Write the ServiceDescription as a WSDL file.
      myDescription->Write( "AddNumbersOut_cs.wsdl" );
      Console::WriteLine( "WSDL file named AddNumbersOut_cs.Wsdl"
      " created successfully." );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception caught!!!" );
      Console::WriteLine( "Source : {0}", e->Source );
      Console::WriteLine( "Message : {0}", e->Message );
   }
}
using System;
using System.Web.Services.Description;
using System.Collections;
using System.Xml;

class MyOperationOutputSample
{
   public static void Main()
   {
      try
      {
         ServiceDescription myDescription =
            ServiceDescription.Read("AddNumbersIn_cs.wsdl");

         // Add the ServiceHttpPost binding.
         Binding myBinding = new Binding();
         myBinding.Name = "ServiceHttpPost";
         XmlQualifiedName myXmlQualifiedName =
            new XmlQualifiedName("s0:ServiceHttpPost");
         myBinding.Type = myXmlQualifiedName;
         HttpBinding myHttpBinding = new HttpBinding();
         myHttpBinding.Verb = "POST";
         myBinding.Extensions.Add(myHttpBinding);

         // Add the operation name AddNumbers.
         OperationBinding myOperationBinding = new OperationBinding();
         myOperationBinding.Name = "AddNumbers";
         HttpOperationBinding myOperation = new HttpOperationBinding();
         myOperation.Location = "/AddNumbers";
         myOperationBinding.Extensions.Add(myOperation);

         // Add the input binding.
         InputBinding myInput = new InputBinding();
         MimeContentBinding postMimeContentbinding =
            new MimeContentBinding();
         postMimeContentbinding.Type= "application/x-www-form-urlencoded";
         myInput.Extensions.Add(postMimeContentbinding);

         // Add the InputBinding to the OperationBinding.
         myOperationBinding.Input = myInput;

         // Add the ouput binding.
         OutputBinding myOutput = new OutputBinding();
         MimeXmlBinding postMimeXmlbinding = new MimeXmlBinding();
         postMimeXmlbinding .Part="Body";
         myOutput.Extensions.Add(postMimeXmlbinding);

         // Add the OutPutBinding to the OperationBinding.
         myOperationBinding.Output = myOutput;

         myBinding.Operations.Add(myOperationBinding);
         myDescription.Bindings.Add(myBinding);

         // Add the port definition.
         Port postPort = new Port();
         postPort.Name = "ServiceHttpPost";
         postPort.Binding = new XmlQualifiedName("s0:ServiceHttpPost");
         HttpAddressBinding postAddressBinding = new HttpAddressBinding();
         postAddressBinding.Location = "http://localhost/Service_cs.asmx";
         postPort.Extensions.Add(postAddressBinding);
         myDescription.Services[0].Ports.Add(postPort);

         // Add the post port type definition.
         PortType postPortType = new PortType();
         postPortType.Name = "ServiceHttpPost";
         Operation postOperation = new Operation();
         postOperation.Name = "AddNumbers";
         OperationMessage postInput =
            (OperationMessage)new OperationInput();
         postInput.Message =
            new XmlQualifiedName("s0:AddNumbersHttpPostIn");
         OperationOutput postOutput = new OperationOutput();
         postOutput.Message =
            new XmlQualifiedName("s0:AddNumbersHttpPostOut");

         postOperation.Messages.Add(postInput);
         postOperation.Messages.Add(postOutput);
         postPortType.Operations.Add(postOperation);
         myDescription.PortTypes.Add(postPortType);

         // Add the first message information.
         Message postMessage1 = new Message();
         postMessage1.Name="AddNumbersHttpPostIn";
         MessagePart postMessagePart1 = new MessagePart();
         postMessagePart1.Name = "firstnumber";
         postMessagePart1.Type = new XmlQualifiedName("s:string");

         // Add the second message information.
         MessagePart postMessagePart2 = new MessagePart();
         postMessagePart2.Name = "secondnumber";
         postMessagePart2.Type = new XmlQualifiedName("s:string");
         postMessage1.Parts.Add(postMessagePart1);
         postMessage1.Parts.Add(postMessagePart2);
         Message postMessage2 = new Message();
         postMessage2.Name = "AddNumbersHttpPostOut";

         // Add the third message information.
         MessagePart postMessagePart3 = new MessagePart();
         postMessagePart3.Name = "Body";
         postMessagePart3.Element = new XmlQualifiedName("s0:int");
         postMessage2.Parts.Add(postMessagePart3);

         myDescription.Messages.Add(postMessage1);
         myDescription.Messages.Add(postMessage2);

         // Write the ServiceDescription as a WSDL file.
         myDescription.Write("AddNumbersOut_cs.wsdl");
         Console.WriteLine("WSDL file named AddNumbersOut_cs.Wsdl" +
            " created successfully.");
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception caught!!!");
         Console.WriteLine("Source : " + e.Source);
         Console.WriteLine("Message : " + e.Message);
      }
   }
}
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml

Class MyOperationOutputSample

   Public Shared Sub Main()
      Try
         Dim myDescription As ServiceDescription = _
            ServiceDescription.Read("AddNumbersIn_vb.wsdl")

         ' Add the ServiceHttpPost binding.
         Dim myBinding As New Binding()
         myBinding.Name = "ServiceHttpPost"
         Dim myXmlQualifiedName As New XmlQualifiedName("s0:ServiceHttpPost")
         myBinding.Type = myXmlQualifiedName
         Dim myHttpBinding As New HttpBinding()
         myHttpBinding.Verb = "POST"
         myBinding.Extensions.Add(myHttpBinding)

         ' Add the operation name AddNumbers.
         Dim myOperationBinding As New OperationBinding()
         myOperationBinding.Name = "AddNumbers"
         Dim myOperation As New HttpOperationBinding()
         myOperation.Location = "/AddNumbers"
         myOperationBinding.Extensions.Add(myOperation)

         ' Add the input binding.
         Dim myInput As New InputBinding()
         Dim postMimeContentbinding As New MimeContentBinding()
         postMimeContentbinding.Type = "application/x-www-form-urlencoded"
         myInput.Extensions.Add(postMimeContentbinding)

         ' Add the InputBinding to the OperationBinding.
         myOperationBinding.Input = myInput

         ' Add the ouput binding.
         Dim myOutput As New OutputBinding()
         Dim postMimeXmlbinding As New MimeXmlBinding()
         postMimeXmlbinding.Part = "Body"
         myOutput.Extensions.Add(postMimeXmlbinding)

         ' Add the OutPutBinding to the OperationBinding.
         myOperationBinding.Output = myOutput

         myBinding.Operations.Add(myOperationBinding)
         myDescription.Bindings.Add(myBinding)

         ' Add the port definition.
         Dim postPort As New Port()
         postPort.Name = "ServiceHttpPost"
         postPort.Binding = New XmlQualifiedName("s0:ServiceHttpPost")
         Dim postAddressBinding As New HttpAddressBinding()
         postAddressBinding.Location = "http://localhost/Service_vb.asmx"
         postPort.Extensions.Add(postAddressBinding)
         myDescription.Services(0).Ports.Add(postPort)

         ' Add the post port type definition.
         Dim postPortType As New PortType()
         postPortType.Name = "ServiceHttpPost"
         Dim postOperation As New Operation()
         postOperation.Name = "AddNumbers"
         Dim postInput As OperationMessage = _
            CType(New OperationInput(), OperationMessage)
         postInput.Message = New XmlQualifiedName("s0:AddNumbersHttpPostIn")
         Dim postOutput As New OperationOutput()
         postOutput.Message = New XmlQualifiedName("s0:AddNumbersHttpPostOut")

         postOperation.Messages.Add(postInput)
         postOperation.Messages.Add(postOutput)
         postPortType.Operations.Add(postOperation)
         myDescription.PortTypes.Add(postPortType)

         ' Add the first message information.
         Dim postMessage1 As New Message()
         postMessage1.Name = "AddNumbersHttpPostIn"
         Dim postMessagePart1 As New MessagePart()
         postMessagePart1.Name = "firstnumber"
         postMessagePart1.Type = New XmlQualifiedName("s:string")

         ' Add the second message information.
         Dim postMessagePart2 As New MessagePart()
         postMessagePart2.Name = "secondnumber"
         postMessagePart2.Type = New XmlQualifiedName("s:string")
         postMessage1.Parts.Add(postMessagePart1)
         postMessage1.Parts.Add(postMessagePart2)
         Dim postMessage2 As New Message()
         postMessage2.Name = "AddNumbersHttpPostOut"

         ' Add the third message information.
         Dim postMessagePart3 As New MessagePart()
         postMessagePart3.Name = "Body"
         postMessagePart3.Element = New XmlQualifiedName("s0:int")
         postMessage2.Parts.Add(postMessagePart3)

         myDescription.Messages.Add(postMessage1)
         myDescription.Messages.Add(postMessage2)

         ' Write the 'ServiceDescription' as a WSDL file.
         myDescription.Write("AddNumbersOut_vb.wsdl")
         Console.WriteLine("WSDL file named AddNumberOut_vb.Wsdl" &  _
            " created successfully.")
      Catch e As Exception
         Console.WriteLine("Exception caught!!!")
         Console.WriteLine("Source : " & e.Source.ToString())
         Console.WriteLine("Message : " & e.Message.ToString())
      End Try
   End Sub
End Class

注釈

このクラスのインスタンスの 1 つだけが、親Operationインスタンスの Messages プロパティのメンバーです。

クラスはOperationOutput、要素で囲まれた operation Web サービス記述言語 (WSDL) output 要素に対応し、 要素で囲まれますportType。 WSDL の詳細については、WSDL 仕様を参照してください。

コンストラクター

OperationOutput()

OperationOutput クラスの新しいインスタンスを初期化します。

プロパティ

Documentation

DocumentableItem のインスタンスのテキスト ドキュメントを取得または設定します。

(継承元 DocumentableItem)
DocumentationElement

DocumentableItem のドキュメント要素を取得または設定します。

(継承元 DocumentableItem)
ExtensibleAttributes

Web Services Interoperability (WS-I) Basic Profile 1.1 に準拠する WSDL の属性の拡張機能を表す XmlAttribute 型の配列を取得または設定します。

(継承元 DocumentableItem)
Extensions

この ServiceDescriptionFormatExtensionCollection に関連付けられている OperationOutput を取得します。

Extensions

この ServiceDescriptionFormatExtensionCollection に関連付けられている DocumentableItem を取得します。

(継承元 DocumentableItem)
Message

通信データの抽象的な型定義を取得または設定します。

(継承元 OperationMessage)
Name

OperationMessage の名前を取得または設定します。

(継承元 OperationMessage)
Namespaces

ServiceDescription オブジェクトが生成されるときに名前空間プレフィックスと名前空間を保持するために使用する、名前空間プレフィックスと名前空間のディクショナリを取得または設定します。

(継承元 DocumentableItem)
Operation

Operation がメンバーとして含まれている OperationMessage を取得します。

(継承元 OperationMessage)

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください