DiscoveryClientProtocol.ResolveAll メソッド

定義

References プロパティ内の探索ドキュメント、XML スキーマ定義 (XSD) スキーマ、およびサービスの説明へのすべての参照と同様に、参照される探索ドキュメント内で見つかった参照も解決します。

public:
 void ResolveAll();
public void ResolveAll ();
member this.ResolveAll : unit -> unit
Public Sub ResolveAll ()

次のコード例は、XML Web サービスの検出中に各ドキュメントに含まれる参照と共に、プロパティ内Documentsのドキュメントに関する詳細を設定DataGridする Web フォームです。 このメソッドは PopulateGridDataGrid 呼び出しの結果と呼び出しの結果 DiscoverAny を入力します ResolveAll

 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;
      }
  // If documents were discovered, display the results in a data grid.
      if (client.Documents.Count > 0)
      PopulateGrid(client);

  // 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

    ' If documents were discovered, display the results in a data grid.
    If (client.Documents.Count > 0) Then
         'populate our Grid with the discovery results
     PopulateGrid(client)
    End If

    ' 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

注釈

ResolveAll は、検索するすべての有効な参照を解決し、プロパティに Documents 配置します。 プロパティ内ReferencesResolveOneLevel XSD スキーマとサービスの説明の両方ResolveAllをダウンロードして確認します。 ただし、2 つの方法は、検出ドキュメントの処理方法が異なります。 ResolveOneLevel は、プロパティ内の探索ドキュメント内のすべての参照を References 解決します。探索ドキュメントに他の探索ドキュメントへの参照が含まれている場合は、 ResolveOneLevel それらの探索ドキュメントのみを解決します。 1 レベル深く入れ子になった検出ドキュメントで検出された検出ドキュメントは解決 ResolveOneLevelされません。一方 ResolveAll 、すべて解決されます。 ResolveAll は、参照がなくなったまで、入れ子になった探索ドキュメント内の参照を解決し続けます。

検証プロセス ResolveAll 中に発生したエラーは、発生した時点でスローされるのではなく、収集されてプロパティに Errors 追加されます。

適用対象