This documentation is archived and is not being maintained.

ServiceDescription.Bindings Property

Gets the collection of Binding elements contained in the ServiceDescription.

[Visual Basic]
Public ReadOnly Property Bindings As BindingCollection
[C#]
public BindingCollection Bindings {get;}
[C++]
public: __property BindingCollection* get_Bindings();
[JScript]
public function get Bindings() : BindingCollection;

Property Value

A BindingCollection.

Remarks

The BindingCollection returned by this property corresponds to the list of <binding> elements enclosed by the Web Services Description Language (WSDL) <definitions> root element. For more information about WSDL, see the specification at http://www.w3.org/TR/wsdl/.

Example

[Visual Basic] 
' Obtain the ServiceDescription from existing WSDL.
Dim myDescription As ServiceDescription = _
   ServiceDescription.Read("MyWsdl_VB.wsdl")
' Remove the Binding from the BindingCollection of 
' the ServiceDescription.
Dim myBindingCollection As BindingCollection = _
   myDescription.Bindings
myBindingCollection.Remove(myBindingCollection(0))

' Form a new Binding.
Dim myBinding As New Binding()
myBinding.Name = "Service1Soap"
Dim myXmlQualifiedName As New XmlQualifiedName("s0:Service1Soap")
myBinding.Type = myXmlQualifiedName

Dim mySoapBinding As New SoapBinding()
mySoapBinding.Transport = "http://schemas.xmlsoap.org/soap/http"
mySoapBinding.Style = SoapBindingStyle.Document

Dim addOperationBinding As OperationBinding = _
   CreateOperationBinding("Add", myDescription.TargetNamespace)
myBinding.Operations.Add(addOperationBinding)
myBinding.Extensions.Add(mySoapBinding)

' Add the Binding to the ServiceDescription.
myDescription.Bindings.Add(myBinding)
myDescription.Write("MyOutWsdl.wsdl")

[C#] 
// Obtain the ServiceDescription from existing WSDL.
ServiceDescription myDescription = 
   ServiceDescription.Read("MyWsdl_CS.wsdl");

// Remove the Binding from the BindingCollection of 
// the ServiceDescription.
BindingCollection myBindingCollection = myDescription.Bindings;
myBindingCollection.Remove(myBindingCollection[0]);

// Form a new Binding.
Binding myBinding = new Binding();
myBinding.Name = "Service1Soap";
XmlQualifiedName myXmlQualifiedName = 
   new XmlQualifiedName("s0:Service1Soap");
myBinding.Type = myXmlQualifiedName;

SoapBinding mySoapBinding = new SoapBinding();
mySoapBinding.Transport = "http://schemas.xmlsoap.org/soap/http";
mySoapBinding.Style = SoapBindingStyle.Document;

OperationBinding addOperationBinding = 
   CreateOperationBinding("Add",myDescription.TargetNamespace);
myBinding.Operations.Add(addOperationBinding);
myBinding.Extensions.Add(mySoapBinding);

// Add the Binding to the ServiceDescription.
myDescription.Bindings.Add(myBinding);
myDescription.Write("MyOutWsdl.wsdl");


[C++] 
// Obtain the ServiceDescription from existing WSDL.
ServiceDescription* myDescription = 
   ServiceDescription::Read(S"MyWsdl_CS.wsdl");

// Remove the Binding from the BindingCollection of 
// the ServiceDescription.
BindingCollection* myBindingCollection = myDescription->Bindings;
myBindingCollection->Remove(myBindingCollection->Item[0]);

// Form a new Binding.
Binding* myBinding = new Binding();
myBinding->Name = S"Service1Soap";
XmlQualifiedName* myXmlQualifiedName = 
   new XmlQualifiedName(S"s0:Service1Soap");
myBinding->Type = myXmlQualifiedName;

SoapBinding* mySoapBinding = new SoapBinding();
mySoapBinding->Transport = S"http://schemas.xmlsoap.org/soap/http";
mySoapBinding->Style = SoapBindingStyle::Document;

OperationBinding* addOperationBinding = 
   CreateOperationBinding(S"Add",myDescription->TargetNamespace);
myBinding->Operations->Add(addOperationBinding);
myBinding->Extensions->Add(mySoapBinding);

// Add the Binding to the ServiceDescription.
myDescription->Bindings->Add(myBinding);
myDescription->Write(S"MyOutWsdl.wsdl");

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

ServiceDescription Class | ServiceDescription Members | System.Web.Services.Description Namespace

Show: