Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Eine Auflistung von Verweisen, die in aufgelösten Discovery-Dokumenten gefunden wurden.
Namespace: System.Web.Services.Discovery
Assembly: System.Web.Services (in system.web.services.dll)
Syntax
'Declaration
Public ReadOnly Property References As DiscoveryClientReferenceCollection
'Usage
Dim instance As DiscoveryClientProtocol
Dim value As DiscoveryClientReferenceCollection
value = instance.References
public DiscoveryClientReferenceCollection References { get; }
public:
property DiscoveryClientReferenceCollection^ References {
DiscoveryClientReferenceCollection^ get ();
}
/** @property */
public DiscoveryClientReferenceCollection get_References ()
public function get References () : DiscoveryClientReferenceCollection
Eigenschaftenwert
Eine DiscoveryClientReferenceCollection von ermittelten Verweisen.
Hinweise
Die References-Auflistung wird während des Aufrufs der Methoden Discover, DiscoverAny, ResolveAll und ResolveOneLevel gefüllt. Während des Aufrufs der Discover-Methode und der DiscoverAny-Methode wird, sofern der angegebene URL ein gültiges Discovery-Dokument darstellt, dieses Dokument zusammen mit den im Discovery-Dokument gefundenen Verweisen der References-Auflistung hinzugefügt. Verweise, die während des Aufrufs der Discover-Methode und der DiscoverAny-Methode hinzugefügt wurden, sind nicht unbedingt gültige Discovery-Dokumente. Während des Aufrufs von ResolveAll und ResolveOneLevel werden Verweise in der References-Auflistung daraufhin überprüft, ob sie gültige Discovery-Dokumente sind. Wenn sie gültig sind und Verweise enthalten, werden sie ebenfalls der References-Auflistung hinzugefügt.
Beispiel
Das folgende Codebeispiel ist ein Web Form, das ein DataGrid mit den ausführlichen Informationen über die Verweise in der References-Eigenschaft füllt, die während der Ausführung des XML Web Services Discovery-Tools gefunden wurde. Die PopulateGrid-Methode füllt das DataGrid mit den Verweisen, die bei einem Aufruf von DiscoverAny gefunden wurden.
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Web.Services.Discovery" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Data" %>
<HTML>
<HEAD>
<SCRIPT RUNAT="SERVER">
Public Sub Discover_Click(Source As Object, e as EventArgs )
' Specify the URL to discover.
Dim sourceUrl as String = DiscoURL.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)
Catch e2 As Exception
DiscoveryResultsGrid.Columns.Clear()
Status.Text = e2.Message
End Try
' If the discovered document contained references, display them in a data grid.
If (client.References.Count > 0) Then
'populate our Grid with the discovery results
PopulateGrid(client)
End If
End Sub
Public Sub PopulateGrid(client As DiscoveryClientProtocol)
Dim dt As DataTable = new DataTable()
Dim dr AS DataRow
dt.Columns.Add(new DataColumn("Reference") )
dt.Columns.Add(new DataColumn("Type") )
Dim entry As DictionaryEntry
' Iterate over the references in the discovered document, displaying their type.
For Each entry in client.References
dr = dt.NewRow()
dr(0) = entry.Key
dr(1) = entry.Value.GetType()
dt.Rows.Add(dr)
Next
Dim dv As DataView = new DataView(dt)
DiscoveryResultsGrid.DataSource = dv
DiscoveryResultsGrid.DataBind()
End Sub
</SCRIPT>
</HEAD>
<BODY>
<H3> <p align="center"> Discovery Class Sample </p> </H3>
<FORM RUNAT="SERVER">
<hr>
Enter the URL to discover:
<asp:textbox id=DiscoURL Columns=60 runat="SERVER" /><p>
<p align="center"> <asp:Button id=Discover Text="Discover!" onClick="Discover_Click" runat="SERVER"/> </p><p>
<hr>
<asp:label id="Status" runat="SERVER" /><p>
<asp:DataGrid id="DiscoveryResultsGrid"
BorderColor="black"
BorderWidth="1"
CellPadding="3"
AutoGenerateColumns="true"
runat="server">
<HeaderStyle BackColor="DarkBlue" ForeColor="White">
</HeaderStyle>
<AlternatingItemStyle BackColor="LightYellow">
</AlternatingItemStyle>
</asp:DataGrid>
</FORM>
</BODY>
<%@ Page Language="C#" Debug="true" %>
<%@ Import Namespace="System.Web.Services.Discovery" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.Data" %>
<HTML>
<HEAD>
<SCRIPT RUNAT="SERVER">
protected void Discover_Click(object Source, EventArgs e)
{
// Specify the URL to discover.
string sourceUrl = DiscoURL.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);
}
catch ( Exception e2)
{
DiscoveryResultsGrid.Columns.Clear();
Status.Text = e2.Message;
}
// If the discovered document contained, references display them in a data grid.
if (client.References.Count > 0)
PopulateGrid(client);
}
protected void PopulateGrid(DiscoveryClientProtocol client)
{
DataTable dt = new DataTable();
DataRow dr;
dt.Columns.Add(new DataColumn("Reference") );
dt.Columns.Add(new DataColumn("Type") );
// Iterate over the references in the discovered document, displaying their type.
foreach (DictionaryEntry entry in client.References)
{
dr = dt.NewRow();
dr[0] = (string) entry.Key;
dr[1] = entry.Value.GetType();
dt.Rows.Add(dr);
}
DataView dv = new DataView(dt);
DiscoveryResultsGrid.DataSource = (ICollection) dv;
DiscoveryResultsGrid.DataBind();
}
</SCRIPT>
</HEAD>
<BODY>
<H3> <p align="center"> Discovery Class Sample </p> </H3>
<FORM RUNAT="SERVER">
<hr>
Enter the URL to discover:
<asp:textbox id=DiscoURL Columns=60 runat="SERVER" /><p>
<p align="center"> <asp:Button id=Discover Text="Discover!" onClick="Discover_Click" runat="SERVER"/> </p><p>
<hr>
<asp:label id="Status" runat="SERVER" /><p>
<asp:DataGrid id="DiscoveryResultsGrid"
BorderColor="black"
BorderWidth="1"
CellPadding="3"
AutoGenerateColumns="true"
runat="server">
<HeaderStyle BackColor="DarkBlue" ForeColor="White">
</HeaderStyle>
<AlternatingItemStyle BackColor="LightYellow">
</AlternatingItemStyle>
</asp:DataGrid>
</FORM>
</BODY>
Plattformen
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 unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
DiscoveryClientProtocol-Klasse
DiscoveryClientProtocol-Member
System.Web.Services.Discovery-Namespace