DiscoveryClientProtocol.Discover メソッド
アセンブリ: System.Web.Services (system.web.services.dll 内)

Dim instance As DiscoveryClientProtocol Dim url As String Dim returnValue As DiscoveryDocument returnValue = instance.Discover(url)
戻り値
指定された URL にある、XML Web サービス探索の結果を格納している DiscoveryDocument。


Discover メソッドでは、指定された URL は探索ドキュメントであると予想しています。URL がサービスの説明または XML スキーマを参照している場合は、例外がスローされます。XML スキーマまたはサービスの説明を探索するには、DiscoverAny メソッドを呼び出します。
指定された URL が有効な探索ドキュメントを指している場合は、その指定された URL が指している探索ドキュメントが Documents コレクションおよび References コレクションに追加されます。さらに、探索ドキュメント内の参照が References コレクションに追加されますが、その参照が有効な探索ドキュメントを指しているかどうかは検証されません。参照が有効な探索ドキュメントを指しているかどうかを検証するには、ResolveAll メソッドまたは ResolveOneLevel メソッドを呼び出します。

Documents プロパティのドキュメントの詳細と共に、XML Web サービスの探索中に各ドキュメントで見つかった参照を DataGrid に読み込む Web フォームのコード例を次に示します。PopulateGrid メソッドは、Discover 呼び出しおよびそれに続く 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 ' Only discover discovery documents, which might contain references to other types of discoverable documents. doc = client.Discover(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
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; // Only discover discovery documents, which might contain references to other types of discoverable documents. doc = client.Discover(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>"; }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からDiscoveryClientProtocol.Discover メソッドを検索する場合は、下記のリンクをクリックしてください。

- DiscoveryClientProtocol.Discover メソッドのページへのリンク