Export (0) Print
Expand All

OperationOutput Class

Defines the specifications for output messages returned by the XML Web service. This class cannot be inherited.

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

public sealed class OperationOutput : OperationMessage
public final class OperationOutput extends OperationMessage
public final class OperationOutput extends OperationMessage
Not applicable.

Exactly one instance of this class is a member of the Messages property of the parent Operation instance.

The OperationOutput class corresponds to the Web Services Description Language (WSDL) output element enclosed by the operation element that is in turn enclosed by the portType element. For more information about WSDL, see the specification at http://www.w3.org/TR/wsdl/.

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);
      }
   }
}

import System.*;
import System.Web.Services.Description.*;
import System.Collections.*;
import System.Xml.*;

class MyOperationOutputSample
{
    public static void main(String[] args)
    {
        try {
            ServiceDescription myDescription = ServiceDescription.
                Read("AddNumbersIn_jsl.wsdl");
            // Add the ServiceHttpPost binding.
            Binding myBinding = new Binding();
            myBinding.set_Name("ServiceHttpPost");
            XmlQualifiedName myXmlQualifiedName = new XmlQualifiedName(
                "s0:ServiceHttpPost");
            myBinding.set_Type(myXmlQualifiedName);
            HttpBinding myHttpBinding = new HttpBinding();
            myHttpBinding.set_Verb("POST");
            myBinding.get_Extensions().Add(myHttpBinding);
            // Add the operation name AddNumbers.
            OperationBinding myOperationBinding = new OperationBinding();
            myOperationBinding.set_Name("AddNumbers");
            HttpOperationBinding myOperation = new HttpOperationBinding();
            myOperation.set_Location("/AddNumbers");
            myOperationBinding.get_Extensions().Add(myOperation);
            // Add the input binding.
            InputBinding myInput = new InputBinding();
            MimeContentBinding postMimeContentbinding = new MimeContentBinding();
            postMimeContentbinding.set_Type("application/x-www-form-urlencoded");
            myInput.get_Extensions().Add(postMimeContentbinding);
            // Add the InputBinding to the OperationBinding.
            myOperationBinding.set_Input(myInput);
            // Add the ouput binding.
            OutputBinding myOutput = new OutputBinding();
            MimeXmlBinding postMimeXmlbinding = new MimeXmlBinding();
            postMimeXmlbinding.set_Part("Body");
            myOutput.get_Extensions().Add(postMimeXmlbinding);
            // Add the OutPutBinding to the OperationBinding.
            myOperationBinding.set_Output(myOutput);

            myBinding.get_Operations().Add(myOperationBinding);
            myDescription.get_Bindings().Add(myBinding);
            // Add the port definition.
            Port postPort = new Port();
            postPort.set_Name("ServiceHttpPost");
            postPort.set_Binding(new XmlQualifiedName("s0:ServiceHttpPost"));
            HttpAddressBinding postAddressBinding = new HttpAddressBinding();
            postAddressBinding.set_Location("http://localhost/Service_jsl.asmx");
            postPort.get_Extensions().Add(postAddressBinding);
            myDescription.get_Services().get_Item(0).get_Ports().Add(postPort);
            // Add the post port type definition.
            PortType postPortType = new PortType();
            postPortType.set_Name("ServiceHttpPost");
            Operation postOperation = new Operation();
            postOperation.set_Name("AddNumbers");
            OperationMessage postInput = (OperationMessage)new OperationInput();
            postInput.
                set_Message(new XmlQualifiedName("s0:AddNumbersHttpPostIn"));
            OperationOutput postOutput = new OperationOutput();
            postOutput.
                set_Message(new XmlQualifiedName("s0:AddNumbersHttpPostOut"));
            postOperation.get_Messages().Add(postInput);
            postOperation.get_Messages().Add(postOutput);
            postPortType.get_Operations().Add(postOperation);
            myDescription.get_PortTypes().Add(postPortType);
            // Add the first message information.
            Message postMessage1 = new Message();
            postMessage1.set_Name("AddNumbersHttpPostIn");
            MessagePart postMessagePart1 = new MessagePart();
            postMessagePart1.set_Name("firstnumber");
            postMessagePart1.set_Type(new XmlQualifiedName("s:string"));
            // Add the second message information.
            MessagePart postMessagePart2 = new MessagePart();
            postMessagePart2.set_Name("secondnumber");
            postMessagePart2.set_Type(new XmlQualifiedName("s:string"));
            postMessage1.get_Parts().Add(postMessagePart1);
            postMessage1.get_Parts().Add(postMessagePart2);
            Message postMessage2 = new Message();
            postMessage2.set_Name("AddNumbersHttpPostOut");
            // Add the third message information.
            MessagePart postMessagePart3 = new MessagePart();
            postMessagePart3.set_Name("Body");
            postMessagePart3.set_Element(new XmlQualifiedName("s0:int"));
            postMessage2.get_Parts().Add(postMessagePart3);
            myDescription.get_Messages().Add(postMessage1);
            myDescription.get_Messages().Add(postMessage2);
            // Write the ServiceDescription as a WSDL file.
            myDescription.Write("AddNumbersOut_jsl.wsdl");
            Console.WriteLine("WSDL file named AddNumbersOut_jsl.Wsdl"
                + " created successfully.");
        }
        catch (System.Exception e) {
            Console.WriteLine("Exception caught!!!");
            Console.WriteLine("Source : " + e.get_Source());
            Console.WriteLine("Message : " + e.get_Message());
        }
    } //main
} //MyOperationOutputSample

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 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft