OperationInput Class
Defines the specifications for input messages received by the XML Web service. This class cannot be inherited.
Assembly: System.Web.Services (in System.Web.Services.dll)
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.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^ postOutput = dynamic_cast<OperationMessage^>(gcnew OperationOutput); postOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" ); OperationInput^ postInput = gcnew OperationInput; postInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); 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 AddNumberOut_cs.Wsdl" " created successfully." ); } catch ( Exception^ e ) { Console::WriteLine( "Exception caught!!!" ); Console::WriteLine( "Source : {0}", e->Source ); Console::WriteLine( "Message : {0}", e->Message ); } }
#using <mscorlib.dll>
#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(S"AddNumbersIn_cs.wsdl");
// Add the ServiceHttpPost binding.
Binding* myBinding = new Binding();
myBinding->Name = S"ServiceHttpPost";
XmlQualifiedName* myXmlQualifiedName =
new XmlQualifiedName (S"s0:ServiceHttpPost");
myBinding->Type = myXmlQualifiedName;
HttpBinding* myHttpBinding = new HttpBinding();
myHttpBinding->Verb = S"POST";
myBinding->Extensions->Add(myHttpBinding);
// Add the operation name AddNumbers.
OperationBinding* myOperationBinding = new OperationBinding();
myOperationBinding->Name = S"AddNumbers";
HttpOperationBinding* myOperation = new HttpOperationBinding();
myOperation->Location = S"/AddNumbers";
myOperationBinding->Extensions->Add(myOperation);
// Add the input binding.
InputBinding* myInput = new InputBinding();
MimeContentBinding* postMimeContentbinding =
new MimeContentBinding();
postMimeContentbinding->Type= S"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= S"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 = S"ServiceHttpPost";
postPort->Binding = new XmlQualifiedName(S"s0:ServiceHttpPost");
HttpAddressBinding* postAddressBinding = new HttpAddressBinding();
postAddressBinding->Location = S"http://localhost/Service.cs.asmx";
postPort->Extensions->Add(postAddressBinding);
myDescription->Services->Item[0]->Ports->Add(postPort);
// Add the post port type definition.
PortType* postPortType = new PortType();
postPortType->Name = S"ServiceHttpPost";
Operation* postOperation = new Operation();
postOperation->Name = S"AddNumbers";
OperationMessage* postOutput =
dynamic_cast<OperationMessage*>(new OperationOutput());
postOutput->Message =
new XmlQualifiedName (S"s0:AddNumbersHttpPostOut");
OperationInput* postInput = new OperationInput();
postInput->Message =
new XmlQualifiedName (S"s0:AddNumbersHttpPostIn");
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=S"AddNumbersHttpPostIn";
MessagePart* postMessagePart1 = new MessagePart();
postMessagePart1->Name = S"firstnumber";
postMessagePart1->Type = new XmlQualifiedName(S"s:string");
// Add the second message information.
MessagePart* postMessagePart2 = new MessagePart();
postMessagePart2->Name = S"secondnumber";
postMessagePart2->Type = new XmlQualifiedName(S"s:string");
postMessage1->Parts->Add(postMessagePart1);
postMessage1->Parts->Add(postMessagePart2);
Message* postMessage2 = new Message();
postMessage2->Name = S"AddNumbersHttpPostOut";
// Add the third message information.
MessagePart* postMessagePart3 = new MessagePart();
postMessagePart3->Name = S"Body";
postMessagePart3->Element = new XmlQualifiedName(S"s0:int");
postMessage2->Parts->Add(postMessagePart3);
myDescription->Messages->Add(postMessage1);
myDescription->Messages->Add(postMessage2);
// Write the ServiceDescription as a WSDL file.
myDescription->Write(S"AddNumbersOut_cs.wsdl");
Console::WriteLine(S"WSDL file named AddNumberOut_cs.Wsdl"
S" created successfully.");
}
catch(Exception* e)
{
Console::WriteLine(S"Exception caught!!!");
Console::WriteLine(S"Source : {0}", e->Source);
Console::WriteLine(S"Message : {0}", e->Message);
}
}
System.Web.Services.Description::DocumentableItem
System.Web.Services.Description::NamedItem
System.Web.Services.Description::OperationMessage
System.Web.Services.Description::OperationInput
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.