次の方法で共有


ServiceDescription.Imports プロパティ

ServiceDescription に格納されている Import 要素のコレクションを取得します。

Public ReadOnly Property Imports As ImportCollection
[C#]
public ImportCollection Imports {get;}
[C++]
public: __property ImportCollection* get_Imports();
[JScript]
public function get Imports() : ImportCollection;

プロパティ値

ImportCollection

解説

このプロパティから返される ImportCollection は、Web サービス記述言語 (WSDL: Web Services Description Language) <definitions> ルート要素で囲まれた <import> 要素のリストに対応します。WSDL の詳細については、http://www.w3.org/TR/wsdl/ の仕様を参照してください。

使用例

 
Dim myServiceDescription As New ServiceDescription()
myServiceDescription = _
   ServiceDescription.Read("ServiceDescription_Imports_Input_VB.wsdl")
Dim myImportCollection As ImportCollection = myServiceDescription.Imports

' Create an Import.
Dim myImport As New Import()
myImport.Namespace = myServiceDescription.TargetNamespace

' Set the location for the Import.
myImport.Location = "https://www.contoso.com/"
myImportCollection.Add(myImport)
myServiceDescription.Write("ServiceDescription_Imports_Output_VB.wsdl")
myImportCollection.Clear()
myServiceDescription = _
   ServiceDescription.Read("ServiceDescription_Imports_Output_VB.wsdl")
myImportCollection = myServiceDescription.Imports
Console.WriteLine( _
   "The Import elements added to the ImportCollection are: ")
Dim i As Integer
For i = 0 To myImportCollection.Count - 1
   Console.WriteLine((i + 1).ToString() & ". " & _
      myImportCollection(i).Location)
Next i

[C#] 
ServiceDescription myServiceDescription = new ServiceDescription();
myServiceDescription = 
   ServiceDescription.Read("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 = "https://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((i+1) + ". " + myImportCollection[i].Location);
}

[C++] 
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"https://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);
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

ServiceDescription クラス | ServiceDescription メンバ | System.Web.Services.Description 名前空間