SoapBodyBinding Class
Represents an extensibility element added to an InputBinding or an OutputBinding.
Assembly: System.Web.Services (in System.Web.Services.dll)
This class specifies how messages, either abstract type definitions or concrete schema definitions, appear within the SOAP body element of the transmission.
For more information about specifying protocols for XML Web services, see [<topic://cpconbuildingaspnetwebservices>]. For more information about Web Services Description Language (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() { ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbersInput_cs.wsdl" ); // Create a 'Binding' object for the 'SOAP' protocol. Binding^ myBinding = gcnew Binding; myBinding->Name = "Service1Soap"; XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" ); myBinding->Type = qualifiedName; SoapBinding^ mySoapBinding = gcnew SoapBinding; mySoapBinding->Transport = SoapBinding::HttpTransport; mySoapBinding->Style = SoapBindingStyle::Document; // Add the 'SoapBinding' object to the 'Binding' object. myBinding->Extensions->Add( mySoapBinding ); // Create the 'OperationBinding' object for the 'SOAP' protocol. OperationBinding^ myOperationBinding = gcnew OperationBinding; myOperationBinding->Name = "AddNumbers"; // Create the 'SoapOperationBinding' object for the 'SOAP' protocol. SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; mySoapOperationBinding->SoapAction = "http://tempuri.org/AddNumbers"; mySoapOperationBinding->Style = SoapBindingStyle::Document; // Add the 'SoapOperationBinding' object to 'OperationBinding' object. myOperationBinding->Extensions->Add( mySoapOperationBinding ); // Create the 'InputBinding' object for the 'SOAP' protocol. InputBinding^ myInput = gcnew InputBinding; SoapBodyBinding^ mySoapBinding1 = gcnew SoapBodyBinding; mySoapBinding1->Use = SoapBindingUse::Literal; myInput->Extensions->Add( mySoapBinding1 ); // Assign the 'InputBinding' to 'OperationBinding'. myOperationBinding->Input = myInput; // Create the 'OutputBinding' object' for the 'SOAP' protocol.. OutputBinding^ myOutput = gcnew OutputBinding; myOutput->Extensions->Add( mySoapBinding1 ); // Assign the 'OutPutBinding' to 'OperationBinding'. myOperationBinding->Output = myOutput; // Add the 'OperationBinding' to 'Binding'. myBinding->Operations->Add( myOperationBinding ); // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. myDescription->Bindings->Add( myBinding ); Port^ soapPort = gcnew Port; soapPort->Name = "Service1Soap"; soapPort->Binding = gcnew XmlQualifiedName( "s0:Service1Soap" ); // Create a 'SoapAddressBinding' object for the 'SOAP' protocol. SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; mySoapAddressBinding->Location = "http://localhost/AddNumbers.cs.asmx"; // Add the 'SoapAddressBinding' to the 'Port'. soapPort->Extensions->Add( mySoapAddressBinding ); // Add the 'Port' to 'PortCollection' of 'ServiceDescription'. myDescription->Services[ 0 ]->Ports->Add( soapPort ); // Write the 'ServiceDescription' as a WSDL file. myDescription->Write( "AddNumbersOut_cs.wsdl" ); Console::WriteLine( " 'AddNumbersOut_cs.Wsdl' file was generated" ); }
#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()
{
ServiceDescription* myDescription =
ServiceDescription::Read(S"AddNumbersInput_cs.wsdl");
// Create a 'Binding' object for the 'SOAP' protocol.
Binding* myBinding = new Binding();
myBinding->Name = S"Service1Soap";
XmlQualifiedName* qualifiedName =
new XmlQualifiedName(S"s0:Service1Soap");
myBinding->Type = qualifiedName;
SoapBinding* mySoapBinding = new SoapBinding();
mySoapBinding->Transport = SoapBinding::HttpTransport;
mySoapBinding->Style = SoapBindingStyle::Document;
// Add the 'SoapBinding' object to the 'Binding' object.
myBinding->Extensions->Add(mySoapBinding);
// Create the 'OperationBinding' object for the 'SOAP' protocol.
OperationBinding* myOperationBinding = new OperationBinding();
myOperationBinding->Name = S"AddNumbers";
// Create the 'SoapOperationBinding' object for the 'SOAP' protocol.
SoapOperationBinding* mySoapOperationBinding =
new SoapOperationBinding();
mySoapOperationBinding->SoapAction = S"http://tempuri.org/AddNumbers";
mySoapOperationBinding->Style = SoapBindingStyle::Document;
// Add the 'SoapOperationBinding' object to 'OperationBinding' object.
myOperationBinding->Extensions->Add(mySoapOperationBinding);
// Create the 'InputBinding' object for the 'SOAP' protocol.
InputBinding* myInput = new InputBinding();
SoapBodyBinding* mySoapBinding1 = new SoapBodyBinding();
mySoapBinding1->Use= SoapBindingUse::Literal;
myInput->Extensions->Add(mySoapBinding1);
// Assign the 'InputBinding' to 'OperationBinding'.
myOperationBinding->Input = myInput;
// Create the 'OutputBinding' object' for the 'SOAP' protocol..
OutputBinding* myOutput = new OutputBinding();
myOutput->Extensions->Add(mySoapBinding1);
// Assign the 'OutPutBinding' to 'OperationBinding'.
myOperationBinding->Output = myOutput;
// Add the 'OperationBinding' to 'Binding'.
myBinding->Operations->Add(myOperationBinding);
// Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
myDescription->Bindings->Add(myBinding);
Port* soapPort = new Port();
soapPort->Name = S"Service1Soap";
soapPort->Binding = new XmlQualifiedName(S"s0:Service1Soap");
// Create a 'SoapAddressBinding' object for the 'SOAP' protocol.
SoapAddressBinding* mySoapAddressBinding =
new SoapAddressBinding();
mySoapAddressBinding->Location = S"http://localhost/AddNumbers.cs.asmx";
// Add the 'SoapAddressBinding' to the 'Port'.
soapPort->Extensions->Add(mySoapAddressBinding);
// Add the 'Port' to 'PortCollection' of 'ServiceDescription'.
myDescription->Services->Item[0]->Ports->Add(soapPort);
// Write the 'ServiceDescription' as a WSDL file.
myDescription->Write(S"AddNumbersOut_cs.wsdl");
Console::WriteLine(S" 'AddNumbersOut_cs.Wsdl' file was generated");
}
System.Web.Services.Description::ServiceDescriptionFormatExtension
System.Web.Services.Description::SoapBodyBinding
System.Web.Services.Description::Soap12BodyBinding
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.