Import クラス

定義

XML 名前空間をドキュメントの位置と関連付けます。 このクラスは継承できません。

public ref class Import sealed : System::Web::Services::Description::DocumentableItem
public sealed class Import : System.Web.Services.Description.DocumentableItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class Import : System.Web.Services.Description.DocumentableItem
type Import = class
    inherit DocumentableItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type Import = class
    inherit DocumentableItem
Public NotInheritable Class Import
Inherits DocumentableItem
継承
属性

次の例は、 クラスの新しいインスタンスを作成するユーザー定義メソッドを Import 示しています。

#using <System.dll>
#using <System.Xml.dll>
#using <System.Web.Services.dll>

using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;
using namespace System::Xml;

// Creates an Import object with namespace and location.
Import^ CreateImport( String^ targetNamespace, String^ targetlocation )
{
   Import^ myImport = gcnew Import;
   myImport->Location = targetlocation;
   myImport->Namespace = targetNamespace;
   return myImport;
}

void PrintImportCollection( String^ fileName_wsdl )
{
   // Read import collection properties from generated WSDL file.
   ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( fileName_wsdl );
   ImportCollection^ myImportCollection = myServiceDescription1->Imports;
   Console::WriteLine( "Enumerating Import Collection for file ' {0}'...", fileName_wsdl );
   
   // Print Import properties to console.
   for ( int i = 0; i < myImportCollection->Count; ++i )
   {
      Console::WriteLine( "Namespace : {0}", myImportCollection[ i ]->Namespace );
      Console::WriteLine( "Location  : {0}", myImportCollection[ i ]->Location );
      Console::WriteLine( "ServiceDescription  : {0}", myImportCollection[ i ]->ServiceDescription->Name );
   }
}

int main()
{
   Console::WriteLine( "Import Sample" );
   
   ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" );
   myServiceDescription->Imports->Add( CreateImport( "http://localhost/stockquote/schemas", "http://localhost/stockquote/stockquote_cpp.xsd" ) );

   // Save the ServiceDescripition to an external file.
   myServiceDescription->Write( "StockQuote_cpp.wsdl" );
   Console::WriteLine( "document 'StockQuote_cpp.wsdl'" );
   
   // Print the import collection to the console.
   PrintImportCollection( "StockQuote_cpp.wsdl" );
   
   myServiceDescription = ServiceDescription::Read( "StockQuoteService_cpp.wsdl" );
   myServiceDescription->Imports->Insert( 0, CreateImport( "http://localhost/stockquote/definitions", "http://localhost/stockquote/stockquote_cpp.wsdl" ) );

   // Save the ServiceDescripition to an external file.
   myServiceDescription->Write( "StockQuoteService_cs::wsdl" );
   Console::WriteLine( "" );
   Console::WriteLine( "document 'StockQuoteService_cpp.wsdl'" );
   
   //Print the import collection to the console.
   PrintImportCollection( "StockQuoteService_cpp.wsdl" );
}
using System;
using System.Web.Services.Description;
using System.Collections;
using System.Xml;

class MySample
{
   public static void Main()
   {
      Console.WriteLine("Import Sample");
      ServiceDescription myServiceDescription =
         ServiceDescription.Read("StockQuote_cs.wsdl");
      myServiceDescription.Imports.Add(
         CreateImport("http://localhost/stockquote/schemas",
         "http://localhost/stockquote/stockquote_cs.xsd"));
      // Save the ServiceDescripition to an external file.
      myServiceDescription.Write("StockQuote_cs.wsdl");
      Console.WriteLine(
         "Successfully added import to WSDL document 'StockQuote_cs.wsdl'");

      // Print the import collection to the console.
      PrintImportCollection("StockQuote_cs.wsdl");
      myServiceDescription =
         ServiceDescription.Read("StockQuoteService_cs.wsdl");
      myServiceDescription.Imports.Insert(
         0,CreateImport("http://localhost/stockquote/definitions",
         "http://localhost/stockquote/stockquote_cs.wsdl"));
      // Save the ServiceDescripition to an external file.
      myServiceDescription.Write("StockQuoteService_cs.wsdl");
      Console.WriteLine("");
      Console.WriteLine("Successfully added import to WSDL " +
         "document 'StockQuoteService_cs.wsdl'");

      //Print the import collection to the console.
      PrintImportCollection("StockQuoteService_cs.wsdl");
   }
   // Creates an Import object with namespace and location.
   public static Import CreateImport(string targetNamespace,
      string targetlocation)
   {
      Import myImport = new Import();
      myImport.Location = targetlocation;
      myImport.Namespace = targetNamespace;
      return myImport;
   }

   public static void PrintImportCollection(string fileName_wsdl)
   {
      // Read import collection properties from generated WSDL file.
      ServiceDescription myServiceDescription1 =
         ServiceDescription.Read(fileName_wsdl);
      ImportCollection myImportCollection = myServiceDescription1.Imports;
      Console.WriteLine("Enumerating Import Collection for file '" +
         fileName_wsdl +"'...");

      // Print Import properties to console.
      for(int i =0; i < myImportCollection.Count; ++i)
      {
         Console.WriteLine("Namespace : " + myImportCollection[i].Namespace);
         Console.WriteLine("Location  : " + myImportCollection[i].Location);
         Console.WriteLine("ServiceDescription  : " +
            myImportCollection[i].ServiceDescription.Name);
      }
   }
}
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml

Class MySample
   Public Shared Sub Main()
      Console.WriteLine("Import Sample")
      
      Dim myServiceDescription As ServiceDescription = _
         ServiceDescription.Read("StockQuote_vb.wsdl")
      myServiceDescription.Imports.Add( _
         CreateImport("http://localhost/stockquote/schemas", _
         "http://localhost/stockquote/stockquote_vb.xsd"))
      ' Save the ServiceDescripition to an external file.
      myServiceDescription.Write("StockQuote_vb.wsdl")
      Console.WriteLine("Successfully added Import to WSDL document " _
         & "'StockQuote_vb.wsdl'")
      ' Print the import collection to the console.
      PrintImportCollection("StockQuote_vb.wsdl")
        myServiceDescription = _
           ServiceDescription.Read("StockQuoteService_vb.wsdl")
      myServiceDescription.Imports.Insert(0, _
         CreateImport("http://localhost/stockquote/definitions", _
         "http://localhost/stockquote/stockquote_vb.wsdl"))
      ' Save the ServiceDescripition to an external file.
      myServiceDescription.Write("StockQuoteService_vb.wsdl")
      Console.WriteLine("")
      Console.WriteLine("Successfully added Import to " & _
         "WSDL document 'StockQuoteService_vb.wsdl'")
      'Print the import collection to the console.
      PrintImportCollection("StockQuoteService_vb.wsdl")
   End Sub

   ' Creates an Import object with namespace and location.
   Public Shared Function CreateImport(targetNamespace As String, _
      targetlocation As String) As Import
      Dim myImport As New Import()
      myImport.Location = targetlocation
      myImport.Namespace = targetNamespace
      Return myImport
   End Function 'CreateImport

   Public Shared Sub PrintImportCollection(fileName_wsdl As String)

      ' Read import collection properties from generated WSDL file.
      Dim myServiceDescription1 As _
         ServiceDescription = ServiceDescription.Read(fileName_wsdl)
      Dim myImportCollection As ImportCollection = myServiceDescription1.Imports
      Console.WriteLine("Enumerating Import Collection for file '" & _
         fileName_wsdl & "'...")

      ' Print Import properties to the console.
      Dim i As Integer
      For i = 0 To myImportCollection.Count - 1
         Console.WriteLine("Namespace : " & myImportCollection(i).Namespace)
         Console.WriteLine("Location  : " & myImportCollection(i).Location)
         Console.WriteLine("ServiceDescription  : " & _
            myImportCollection(i).ServiceDescription.Name)
      Next i
   End Sub
End Class

注釈

要素でdefinitions囲まれた Web サービス記述言語 (WSDL) import 要素を使用すると、XML Web サービスのさまざまな部分を異なるドキュメントに分離し、必要に応じてインポートできます。 各ドキュメントの URL は、そのドキュメントの要素の XML 名前空間を表す一意の XML タグ プレフィックスに関連付けられています。 WSDL の詳細については、WSDL 仕様を参照してください。 XML 名前空間の詳細については、 プロパティを Namespace 参照してください。

コンストラクター

Import()

Import クラスの新しいインスタンスを初期化します。

プロパティ

Documentation

DocumentableItem のインスタンスのテキスト ドキュメントを取得または設定します。

(継承元 DocumentableItem)
DocumentationElement

DocumentableItem のドキュメント要素を取得または設定します。

(継承元 DocumentableItem)
ExtensibleAttributes

Web Services Interoperability (WS-I) Basic Profile 1.1 に準拠する WSDL の属性の拡張機能を表す XmlAttribute 型の配列を取得または設定します。

(継承元 DocumentableItem)
Extensions

この ServiceDescriptionFormatExtensionCollection クラスに関連付けられている Import を取得します。

Extensions

この ServiceDescriptionFormatExtensionCollection に関連付けられている DocumentableItem を取得します。

(継承元 DocumentableItem)
Location

location 要素の XML import 属性の値を取得または設定します。

Namespace

namespace 要素の XML import 属性の値を取得または設定します。

Namespaces

ServiceDescription オブジェクトが生成されるときに名前空間プレフィックスと名前空間を保持するために使用する、名前空間プレフィックスと名前空間のディクショナリを取得または設定します。

(継承元 DocumentableItem)
ServiceDescription

ServiceDescription がメンバーとして含まれている Import への参照を取得します。

メソッド

Equals(Object)

指定されたオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象