ServiceDescription.Write メソッド (String)
ServiceDescription を Web サービス記述言語 (WSDL) ファイルとして指定したパスに書き込みます。
Overloads Public Sub Write( _
ByVal fileName As String _)
[C#]
public void Write(stringfileName);
[C++]
public: void Write(String* fileName);
[JScript]
public function Write(
fileName : String);
パラメータ
- fileName
WSDL ファイルを書き込むパス。
使用例
' Read a ServiceDescription from existing WSDL.
Dim myServiceDescription As ServiceDescription = _
ServiceDescription.Read("Input.vb.wsdl")
myServiceDescription.TargetNamespace = "http://tempuri.org/"
' Get the ServiceCollection of the ServiceDescription.
Dim myServiceCollection As ServiceCollection = _
myServiceDescription.Services
' Remove the Service at index 0 of the collection.
myServiceCollection.Remove(myServiceDescription.Services.Item(0))
' Build a new Service.
Dim myService As New Service()
myService.Name = "MathService"
Dim myXmlQualifiedName As New XmlQualifiedName("s0:MathServiceSoap")
' Build a new Port for SOAP.
Dim mySoapPort As New Port()
mySoapPort.Name = "MathServiceSoap"
mySoapPort.Binding = myXmlQualifiedName
Dim mySoapAddressBinding As New SoapAddressBinding()
mySoapAddressBinding.Location = _
"https://localhost/ServiceCollection_Item/AddSub.vb.asmx"
mySoapPort.Extensions.Add(mySoapAddressBinding)
' Build a new Port for HTTP-GET.
Dim myXmlQualifiedName2 As _
New XmlQualifiedName("s0:MathServiceHttpGet")
Dim myHttpGetPort As New Port()
myHttpGetPort.Name = "MathServiceHttpGet"
myHttpGetPort.Binding = myXmlQualifiedName2
Dim myHttpAddressBinding As New HttpAddressBinding()
myHttpAddressBinding.Location = _
"https://localhost/ServiceCollection_Item/AddSub.vb.asmx"
myHttpGetPort.Extensions.Add(myHttpAddressBinding)
' Add the ports to the service.
myService.Ports.Add(myHttpGetPort)
myService.Ports.Add(mySoapPort)
' Add the service to the ServiceCollection.
myServiceCollection.Add(myService)
' Write to a new WSDL file.
myServiceDescription.Write("output.wsdl")
[C#]
// Read a ServiceDescription from existing WSDL.
ServiceDescription myServiceDescription =
ServiceDescription.Read("Input_CS.wsdl");
myServiceDescription.TargetNamespace = "http://tempuri.org/";
// Get the ServiceCollection of the ServiceDescription.
ServiceCollection myServiceCollection = myServiceDescription.Services;
// Remove the Service at index 0 of the collection.
myServiceCollection.Remove(myServiceDescription.Services[0]);
// Build a new Service.
Service myService = new Service();
myService.Name = "MathService";
XmlQualifiedName myXmlQualifiedName =
new XmlQualifiedName("s0:MathServiceSoap");
// Build a new Port for SOAP.
Port mySoapPort= new Port();
mySoapPort.Name = "MathServiceSoap";
mySoapPort.Binding = myXmlQualifiedName;
SoapAddressBinding mySoapAddressBinding = new SoapAddressBinding();
mySoapAddressBinding.Location =
"https://localhost/ServiceCollection_Item/AddSub_CS.asmx";
mySoapPort.Extensions.Add(mySoapAddressBinding);
// Build a new Port for HTTP-GET.
XmlQualifiedName myXmlQualifiedName2 =
new XmlQualifiedName("s0:MathServiceHttpGet");
Port myHttpGetPort= new Port();
myHttpGetPort.Name="MathServiceHttpGet";
myHttpGetPort.Binding=myXmlQualifiedName2;
HttpAddressBinding myHttpAddressBinding = new HttpAddressBinding();
myHttpAddressBinding.Location =
"https://localhost/ServiceCollection_Item/AddSub_CS.asmx";
myHttpGetPort.Extensions.Add(myHttpAddressBinding);
// Add the ports to the service.
myService.Ports.Add(myHttpGetPort);
myService.Ports.Add(mySoapPort);
// Add the service to the ServiceCollection.
myServiceCollection .Add(myService);
// Write to a new WSDL file.
myServiceDescription.Write("output.wsdl");
[C++]
// Read a ServiceDescription from existing WSDL.
ServiceDescription* myServiceDescription =
ServiceDescription::Read(S"Input_CS.wsdl");
myServiceDescription->TargetNamespace = S"http://tempuri.org/";
// Get the ServiceCollection of the ServiceDescription.
ServiceCollection* myServiceCollection = myServiceDescription->Services;
// Remove the Service at index 0 of the collection.
myServiceCollection->Remove(myServiceDescription->Services->Item[0]);
// Build a new Service.
Service* myService = new Service();
myService->Name = S"MathService";
XmlQualifiedName* myXmlQualifiedName =
new XmlQualifiedName(S"s0:MathServiceSoap");
// Build a new Port for SOAP.
Port* mySoapPort= new Port();
mySoapPort->Name = S"MathServiceSoap";
mySoapPort->Binding = myXmlQualifiedName;
SoapAddressBinding* mySoapAddressBinding = new SoapAddressBinding();
mySoapAddressBinding->Location =
S"https://localhost/ServiceCollection_Item/AddSub_CS.asmx";
mySoapPort->Extensions->Add(mySoapAddressBinding);
// Build a new Port for HTTP-GET.
XmlQualifiedName* myXmlQualifiedName2 =
new XmlQualifiedName(S"s0:MathServiceHttpGet");
Port* myHttpGetPort= new Port();
myHttpGetPort->Name=S"MathServiceHttpGet";
myHttpGetPort->Binding=myXmlQualifiedName2;
HttpAddressBinding* myHttpAddressBinding = new HttpAddressBinding();
myHttpAddressBinding->Location =
S"https://localhost/ServiceCollection_Item/AddSub_CS.asmx";
myHttpGetPort->Extensions->Add(myHttpAddressBinding);
// Add the ports to the service.
myService->Ports->Add(myHttpGetPort);
myService->Ports->Add(mySoapPort);
// Add the service to the ServiceCollection.
myServiceCollection ->Add(myService);
// Write to a new WSDL file.
myServiceDescription->Write(S"output.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 名前空間 | ServiceDescription.Write オーバーロードの一覧