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 ();
}
/** @property */
public ImportCollection get_Imports ()

public function get Imports () : ImportCollection

Not applicable.

Property Value

An ImportCollection.

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(
    "ServiceDescription_Imports_Input_JSL.wsdl");
ImportCollection myImportCollection = 
    myServiceDescription.get_Imports();

// Create an Import.
Import myImport = new Import();
myImport.set_Namespace(myServiceDescription.get_TargetNamespace());

// Set the location for the Import.
myImport.set_Location("http://www.contoso.com/");
myImportCollection.Add(myImport);
myServiceDescription.Write(
    "ServiceDescription_Imports_Output_JSL.wsdl");
myImportCollection.Clear();
myServiceDescription = ServiceDescription.Read(
    "ServiceDescription_Imports_Output_JSL.wsdl");
myImportCollection = myServiceDescription.get_Imports();
Console.WriteLine("The Import elements added to the " +
    " ImportCollection are: ");
for (int i = 0; i < myImportCollection.get_Count(); i++) {
    Console.WriteLine(i + 1 + ". " 
        + myImportCollection.get_Item(i).get_Location());
}

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.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: