BindingCollection.Insert Method
.NET Framework 2.0
Adds the specified Binding to the BindingCollection at the specified zero-based index.
Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)
Assembly: System.Web.Services (in system.web.services.dll)
public void Insert ( int index, Binding binding )
public function Insert ( index : int, binding : Binding )
Not applicable.
Parameters
- index
The zero-based index at which to insert the binding parameter.
- binding
The Binding to be added to the collection.
If the number of items in the collection already equals the collection's capacity, the capacity is doubled by automatically reallocating the internal array before the new element is inserted.
If the index parameter is equal to Count, the binding parameter is added to the end of the BindingCollection.
The elements after the insertion point move down to accommodate the new element.
// Create a new Binding for SOAP Protocol. Binding^ myBinding = gcnew Binding; myBinding->Name = String::Concat( myServiceDescription->Services->default[ 0 ]->Name, "Soap" ); // Pass the name of the existing porttype 'MathServiceSoap' and the Xml targetNamespace attribute of the Descriptions tag. myBinding->Type = gcnew XmlQualifiedName( "MathServiceSoap",myServiceDescription->TargetNamespace ); // Create SOAP Extensibility element. SoapBinding^ mySoapBinding = gcnew SoapBinding; // SOAP over HTTP. mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; mySoapBinding->Style = SoapBindingStyle::Document; // Add tag soap:binding as an extensibility element. myBinding->Extensions->Add( mySoapBinding ); // Create OperationBindings for each of the operations defined in asmx file. OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myServiceDescription->TargetNamespace ); myBinding->Operations->Add( addOperationBinding ); OperationBinding^ subtractOperationBinding = CreateOperationBinding( "Subtract", myServiceDescription->TargetNamespace ); myBinding->Operations->Add( subtractOperationBinding ); OperationBinding^ multiplyOperationBinding = CreateOperationBinding( "Multiply", myServiceDescription->TargetNamespace ); myBinding->Operations->Add( multiplyOperationBinding ); OperationBinding^ divideOperationBinding = CreateOperationBinding( "Divide", myServiceDescription->TargetNamespace ); myBinding->Operations->Add( divideOperationBinding ); myServiceDescription->Bindings->Insert( 0, myBinding );
// Create a new Binding for SOAP Protocol.
Binding myBinding = new Binding();
myBinding.set_Name(((Service)myServiceDescription.get_Services().
get_Item(0)).get_Name() + "Soap");
// Pass the name of the existing porttype 'MathServiceSoap' and
// the Xml targetNamespace attribute of the Descriptions tag.
myBinding.set_Type(new XmlQualifiedName("MathServiceSoap",
myServiceDescription.get_TargetNamespace()));
// Create SOAP Extensibility element.
SoapBinding mySoapBinding = new SoapBinding();
// SOAP over HTTP.
mySoapBinding.set_Transport("http://schemas.xmlsoap.org/soap/http");
mySoapBinding.set_Style(SoapBindingStyle.Document);
// Add tag soap:binding as an extensibility element.
myBinding.get_Extensions().Add(mySoapBinding);
// Create OperationBindings for each of the operations defined
// in asmx file.
OperationBinding addOperationBinding = CreateOperationBinding("Add",
myServiceDescription.get_TargetNamespace());
myBinding.get_Operations().Add(addOperationBinding);
OperationBinding subtractOperationBinding = CreateOperationBinding(
"Subtract", myServiceDescription.get_TargetNamespace());
myBinding.get_Operations().Add(subtractOperationBinding);
OperationBinding multiplyOperationBinding = CreateOperationBinding(
"Multiply", myServiceDescription.get_TargetNamespace());
myBinding.get_Operations().Add(multiplyOperationBinding);
OperationBinding divideOperationBinding = CreateOperationBinding(
"Divide", myServiceDescription.get_TargetNamespace());
myBinding.get_Operations().Add(divideOperationBinding);
myServiceDescription.get_Bindings().Insert(0, myBinding);
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.Community Additions
ADD
Show: