Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
OperationInput Class
Collapse the table of content
Expand the table of content

OperationInput Class

Defines the specifications for input messages received 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 OperationInput : OperationMessage

The OperationInput type exposes the following members.

Public methodOperationInputInitializes a new instance of the OperationInput class.

Public propertyDocumentationGets or sets the text documentation for the instance of the DocumentableItem. (Inherited from DocumentableItem.)
Public propertyDocumentationElementGets or sets the documentation element for the DocumentableItem. (Inherited from DocumentableItem.)
Public propertyExtensibleAttributesGets or sets an array of type XmlAttribute that represents attribute extensions of WSDL to comply with Web Services Interoperability (WS-I) Basic Profile 1.1. (Inherited from DocumentableItem.)
Public propertyExtensionsGets the ServiceDescriptionFormatExtensionCollection associated with this OperationInput. (Overrides DocumentableItem.Extensions.)
Public propertyMessageGets or sets an abstract, typed definition of the data being communicated. (Inherited from OperationMessage.)
Public propertyNameGets or sets the name of the item. (Inherited from NamedItem.)
Public propertyNamespacesGets or sets the dictionary of namespace prefixes and namespaces used to preserve namespace prefixes and namespaces when a ServiceDescription object is constructed. (Inherited from DocumentableItem.)
Public propertyOperationGets the Operation of which the OperationMessage is a member. (Inherited from OperationMessage.)

Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

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

The OperationInput class corresponds to the Web Services Description Language (WSDL) input 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 MyOperationInputSample
   public static void Main()
         ServiceDescription myDescription = 

         // 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";

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

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

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

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

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


         // 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";

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


         // Add the first message information.
         Message postMessage1 = new Message();
         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");
         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");


         // Write the ServiceDescription as a WSDL file.
         Console.WriteLine("WSDL file named AddNumberOut_cs.Wsdl" +
            " created successfully.");
      catch(Exception e)
         Console.WriteLine("Exception caught!!!");
         Console.WriteLine("Source : " + e.Source);
         Console.WriteLine("Message : " + e.Message);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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