ServiceDescriptionCollection Class
.NET Framework 2.0
Represents a collection of instances of the ServiceDescription class. This class cannot be inherited.
Namespace: System.Web.Services.Description
Assembly: System.Web.Services (in system.web.services.dll)
Assembly: System.Web.Services (in system.web.services.dll)
#using <System.Web.Services.dll> #using <System.Xml.dll> using namespace System; using namespace System::Xml; using namespace System::Web::Services::Description; int main() { try { // Get ServiceDescription objects. ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( "DataTypes_cpp.wsdl" ); ServiceDescription^ myServiceDescription2 = ServiceDescription::Read( "MathService_cpp.wsdl" ); // Set the names of the ServiceDescriptions. myServiceDescription1->Name = "DataTypes"; myServiceDescription2->Name = "MathService"; // Create a ServiceDescriptionCollection. ServiceDescriptionCollection^ myServiceDescriptionCollection = gcnew ServiceDescriptionCollection; // Add the ServiceDescriptions to the collection. myServiceDescriptionCollection->Add( myServiceDescription1 ); myServiceDescriptionCollection->Add( myServiceDescription2 ); // Display the elements of the collection using the Item property. Console::WriteLine( "Elements in the collection: " ); for ( int i = 0; i < myServiceDescriptionCollection->Count; i++ ) Console::WriteLine( myServiceDescriptionCollection[ i ]->Name ); // Construct an XML qualified name. XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MathServiceSoap","http://tempuri2.org/" ); // Get the Binding from the collection. Binding^ myBinding = myServiceDescriptionCollection->GetBinding( myXmlQualifiedName ); Console::WriteLine( "Binding found in collection with name: {0}", myBinding->ServiceDescription->Name ); } catch ( Exception^ e ) { Console::WriteLine( "The following exception was raised: {0}", e->Message ); } }
import System.*;
import System.Xml.*;
import System.Web.Services.Description.*;
class MyServiceDescriptionCollection
{
public static void main(String[] args)
{
try {
// Get ServiceDescription objects.
ServiceDescription myServiceDescription1 = ServiceDescription.
Read("DataTypes_JSL.wsdl");
ServiceDescription myServiceDescription2 = ServiceDescription.
Read("MathService_JSL.wsdl");
// Set the names of the ServiceDescriptions.
myServiceDescription1.set_Name("DataTypes");
myServiceDescription2.set_Name("MathService");
// Create a ServiceDescriptionCollection.
ServiceDescriptionCollection myServiceDescriptionCollection = new
ServiceDescriptionCollection();
// Add the ServiceDescriptions to the collection.
myServiceDescriptionCollection.Add(myServiceDescription1);
myServiceDescriptionCollection.Add(myServiceDescription2);
// Display the elements of the collection using the indexer.
Console.WriteLine("Elements in the collection: ");
for (int i = 0;i < myServiceDescriptionCollection.get_Count();i++) {
Console.WriteLine(myServiceDescriptionCollection.get_Item(i).
get_Name());
}
// Construct an XML qualified name.
XmlQualifiedName myXmlQualifiedName = new
XmlQualifiedName("MathServiceSoap", "http://tempuri2.org/");
// Get the Binding from the collection.
Binding myBinding = myServiceDescriptionCollection.
GetBinding(myXmlQualifiedName);
Console.WriteLine("Binding found in collection with name: "
+ myBinding.get_ServiceDescription().get_Name());
}
catch (System.Exception e) {
Console.WriteLine("The following exception was raised: {0}",
e.get_Message());
}
} //main
} //MyServiceDescriptionCollection
System.Object
System.Collections.CollectionBase
System.Web.Services.Description.ServiceDescriptionBaseCollection
System.Web.Services.Description.ServiceDescriptionCollection
System.Collections.CollectionBase
System.Web.Services.Description.ServiceDescriptionBaseCollection
System.Web.Services.Description.ServiceDescriptionCollection
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: