次の方法で共有


ServiceDescription.Bindings プロパティ

ServiceDescription に格納されている Binding 要素のコレクションを取得します。

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

プロパティ値

BindingCollection

解説

このプロパティから返される BindingCollection は、Web サービス記述言語 (WSDL: Web Services Description Language) <definitions> ルート要素で囲まれた <binding> 要素のリストに対応します。WSDL の詳細については、http://www.w3.org/TR/wsdl/ の仕様を参照してください。

使用例

 
' 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 = "https://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 = "https://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"https://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] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

ServiceDescription クラス | ServiceDescription メンバ | System.Web.Services.Description 名前空間