DiscoveryClientProtocol.WriteAll(String, String) メソッド

定義

Documents プロパティの探索ドキュメント、XML スキーマ定義 (XSD) スキーマ、およびサービスの説明のすべてを指定されたディレクトリに書き込み、そのディレクトリにファイルを作成します。

public:
 System::Web::Services::Discovery::DiscoveryClientResultCollection ^ WriteAll(System::String ^ directory, System::String ^ topLevelFilename);
public System.Web.Services.Discovery.DiscoveryClientResultCollection WriteAll (string directory, string topLevelFilename);
member this.WriteAll : string * string -> System.Web.Services.Discovery.DiscoveryClientResultCollection
Public Function WriteAll (directory As String, topLevelFilename As String) As DiscoveryClientResultCollection

パラメーター

directory
String

現在 Documents プロパティにあるすべてのドキュメントの保存先ディレクトリ。

topLevelFilename
String

保存されているすべてのドキュメントのマップを格納している、作成または上書きするファイルの名前。

戻り値

保存されているすべてのファイルの結果を格納している DiscoveryClientResultCollection

次のコード例は、 および ResolveAllの呼び出し後に メソッドを呼び出すことによって、Web サービス検出の結果をWriteAllディスクにDiscoverAny書き込む Web フォームです。

 protected void Discover_Click(object Source, EventArgs e)
 {
  // Specify the URL to discover.
  string sourceUrl = DiscoURL.Text;
  // Specify the URL to save discovery results to or read from.
  string outputDirectory = DiscoDir.Text;

      DiscoveryClientProtocol client = new DiscoveryClientProtocol();
  // Use default credentials to access the URL being discovered.
      client.Credentials = CredentialCache.DefaultCredentials;

      try 
      {
        DiscoveryDocument doc;
        
        // Discover the URL for any discoverable documents. 
    doc = client.DiscoverAny(sourceUrl);
   
        // Resolve all possible references from the supplied URL.
        client.ResolveAll();
      }
      catch ( Exception e2) 
      {
        DiscoveryResultsGrid.Columns.Clear();
        Status.Text = e2.Message;
      }

  // Save the discovery results to disk.
      DiscoveryClientResultCollection results = client.WriteAll(outputDirectory, "results.discomap");
      Status.Text = "The following file holds the links to each of the discovery results: <b>" + 
                                  Path.Combine(outputDirectory,"results.discomap") + "</b>";
}
Public Sub Discover_Click(Source As Object, e as EventArgs )
   ' Specify the URL to discover.
   Dim sourceUrl as String = DiscoURL.Text
   ' Specify the URL to save discovery results to or read from.
   Dim outputDirectory As String = DiscoDir.Text

   Dim client as DiscoveryClientProtocol = new DiscoveryClientProtocol()
   ' Use default credentials to access the URL being discovered.
   client.Credentials = CredentialCache.DefaultCredentials
   Try 
     Dim doc As DiscoveryDocument
     ' Discover the URL for any discoverable documents. 
     doc = client.DiscoverAny(sourceUrl)

 ' Resolve all possible references from the supplied URL.
     client.ResolveAll()
           
    Catch e2 As Exception
       DiscoveryResultsGrid.Columns.Clear()
       Status.Text = e2.Message
    End Try

    ' Save the discovery results to disk.	    
    Dim results As DiscoveryClientResultCollection 
    results = client.WriteAll(outputDirectory, "results.discomap")
    Status.Text = "The following file holds the links to each of the discovery results: <b>" + _ 
                                  Path.Combine(outputDirectory,"results.discomap") + "</b>"
   End Sub

注釈

ディレクトリ パラメーターで指定されたディレクトリ内の パラメーターの topLevelFilename 名前で作成されたファイルには、保存された検出ドキュメント、XML スキーマ定義 (XSD) スキーマ、およびサービスの説明のマップが含まれています。 このファイルは、 メソッドをReadAll使用して プロパティと Documents プロパティを設定Referencesすることで読み取ることができます。 ファイルの形式は、 クラスのシリアル化されたバージョン DiscoveryClientProtocol.DiscoveryClientResultsFile を含む XML です。

パラメーター内の パラメーターと同じ名前のファイルが topLevelFilename 存在する directory 場合、そのファイルは メソッドによって WriteAll 上書きされます。 ファイルが現在のディレクトリに存在しない場合は topLevelFilename 、パラメーターに完全修飾パスを含める必要があります。

適用対象

こちらもご覧ください