ServiceCollection.Add メソッド
アセンブリ: System.Web.Services (system.web.services.dll 内)

Dim instance As ServiceCollection Dim service As Service Dim returnValue As Integer returnValue = instance.Add(service)
戻り値
service パラメータが追加された、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 = _ "http://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 = _ "http://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)
// 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 = "http://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 = "http://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);
// Build a new Service. Service^ myService = gcnew Service; myService->Name = "MathService"; XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap" ); // Build a new Port for SOAP. Port^ mySoapPort = gcnew Port; mySoapPort->Name = "MathServiceSoap"; mySoapPort->Binding = myXmlQualifiedName; SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; mySoapAddressBinding->Location = "http://localhost/ServiceCollection_Item/AddSub_CS.asmx"; mySoapPort->Extensions->Add( mySoapAddressBinding ); // Build a new Port for HTTP-GET. XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:MathServiceHttpGet" ); Port^ myHttpGetPort = gcnew Port; myHttpGetPort->Name = "MathServiceHttpGet"; myHttpGetPort->Binding = myXmlQualifiedName2; HttpAddressBinding^ myHttpAddressBinding = gcnew HttpAddressBinding; myHttpAddressBinding->Location = "http://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 );
// Build a new Service. Service myService = new Service(); myService.set_Name("MathService"); XmlQualifiedName myXmlQualifiedName = new XmlQualifiedName( "s0:MathServiceSoap"); // Build a new Port for SOAP. Port mySoapPort = new Port(); mySoapPort.set_Name("MathServiceSoap"); mySoapPort.set_Binding(myXmlQualifiedName); SoapAddressBinding mySoapAddressBinding = new SoapAddressBinding(); mySoapAddressBinding.set_Location("http://localhost/" + "ServiceCollection_Item/AddSub_JSL.asmx"); mySoapPort.get_Extensions().Add(mySoapAddressBinding); // Build a new Port for HTTP-GET. XmlQualifiedName myXmlQualifiedName2 = new XmlQualifiedName( "s0:MathServiceHttpGet"); Port myHttpGetPort = new Port(); myHttpGetPort.set_Name("MathServiceHttpGet"); myHttpGetPort.set_Binding(myXmlQualifiedName2); HttpAddressBinding myHttpAddressBinding = new HttpAddressBinding(); myHttpAddressBinding.set_Location("http://localhost/" + "ServiceCollection_Item/AddSub_JSL.asmx"); myHttpGetPort.get_Extensions().Add(myHttpAddressBinding); // Add the ports to the service. myService.get_Ports().Add(myHttpGetPort); myService.get_Ports().Add(mySoapPort); // Add the service to the ServiceCollection. myServiceCollection.Add(myService);

Windows 98, Windows 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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- ServiceCollection.Add メソッドのページへのリンク