This documentation is archived and is not being maintained.

ServiceDescription::Imports Property

Gets the collection of Import elements contained in the ServiceDescription.

Namespace:  System.Web.Services.Description
Assembly:  System.Web.Services (in System.Web.Services.dll)

public:
property ImportCollection^ Imports {
	ImportCollection^ get ();
}

The ImportCollection returned by this property corresponds to the list of import 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/.

ServiceDescription^ myServiceDescription = gcnew ServiceDescription;
myServiceDescription = ServiceDescription::Read( "ServiceDescription_Imports_Input_CS.wsdl" );
ImportCollection^ myImportCollection = myServiceDescription->Imports;

// Create an Import.
Import^ myImport = gcnew Import;
myImport->Namespace = myServiceDescription->TargetNamespace;

// Set the location for the Import.
myImport->Location = "http://www.contoso.com/";
myImportCollection->Add( myImport );
myServiceDescription->Write( "ServiceDescription_Imports_Output_CS.wsdl" );
myImportCollection->Clear();
myServiceDescription = ServiceDescription::Read( "ServiceDescription_Imports_Output_CS.wsdl" );
myImportCollection = myServiceDescription->Imports;
Console::WriteLine( "The Import elements added to the ImportCollection are: " );
for ( int i = 0; i < myImportCollection->Count; i++ )
{
   Console::WriteLine( "{0}. {1}", (i + 1), myImportCollection[ i ]->Location );
}
ServiceDescription* myServiceDescription = new ServiceDescription();
myServiceDescription = 
   ServiceDescription::Read(S"ServiceDescription_Imports_Input_CS.wsdl");
ImportCollection* myImportCollection = myServiceDescription->Imports;

// Create an Import.
Import* myImport = new Import();
myImport->Namespace = myServiceDescription->TargetNamespace;

// Set the location for the Import.
myImport->Location = S"http://www.contoso.com/";
myImportCollection->Add(myImport);
myServiceDescription->Write(S"ServiceDescription_Imports_Output_CS.wsdl");
myImportCollection->Clear();
myServiceDescription = 
   ServiceDescription::Read(S"ServiceDescription_Imports_Output_CS.wsdl");
myImportCollection = myServiceDescription->Imports;
Console::WriteLine(
   S"The Import elements added to the ImportCollection are: ");
for(int i = 0; i < myImportCollection->Count; i++)
{
   Console::WriteLine(S"{0}. {1}", __box((i+1)), myImportCollection->Item[i]->Location);
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Show: