DiscoveryClientProtocol.ResolveAll メソッド
References プロパティ内の探索ドキュメント、XML スキーマ定義 (XSD) スキーマ、およびサービスの説明へのすべての参照と同様に、参照される探索ドキュメント内で見つかった参照も解決します。
Public Sub ResolveAll()
[C#]
public void ResolveAll();
[C++]
public: void ResolveAll();
[JScript]
public function ResolveAll();
解説
ResolveAll は見つけたすべての有効な参照を解決して Documents プロパティに格納します。 ResolveAll と ResolveOneLevel はどちらも References プロパティの XSD スキーマとサービスの説明をダウンロードして検証します。ただし、これら 2 つのメソッドでは探索ドキュメントの処理方法が異なります。 ResolveOneLevel は References プロパティ内にある探索ドキュメントのすべての参照を解決します。探索ドキュメントが他の探索ドキュメントへの参照を含んでいる場合は、 ResolveOneLevel は当該探索ドキュメントだけを解決します。これらの探索ドキュメント内で見つかった探索ドキュメントのうち、1 レベル入れ子になっているドキュメントは ResolveOneLevel では解決されないのに対し、 ResolveAll はすべてを解決します。 ResolveAll は参照がなくなるまで入れ子になっている探索ドキュメントの参照の解決を継続します。
ResolveAll によって実行される検査プロセスの間に発生したエラーは、そのときに例外をスローするのではなく、収集されて Errors プロパティに追加されます。
使用例
[Visual Basic, C#] Documents プロパティのドキュメントの詳細と共に、XML Web サービスの探索中に各ドキュメントで見つかった参照を DataGrid に読み込む Web フォームのコード例を次に示します。 PopulateGrid
メソッドは、 DiscoverAny 呼び出しおよびそれに続く ResolveAll 呼び出しの結果を DataGrid に設定します。
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
[C#]
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>";
}
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
DiscoveryClientProtocol クラス | DiscoveryClientProtocol メンバ | System.Web.Services.Discovery 名前空間