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 Value

Type: System.Web.Services.Description::ImportCollection^

A collection of import elements contained in the service description.

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 );
}

.NET Framework
Available since 1.1
Return to top
Show: