DiscoveryClientProtocol.WriteAll(String, String) Metódus
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
A tulajdonságban Documents található összes felderítési dokumentumot, XML-sémadefiníciós (XSD) sémát és szolgáltatásleírást a megadott könyvtárba írja, és létrehoz egy fájlt az adott könyvtárban.
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
Paraméterek
- directory
- String
Az a könyvtár, amelybe a Documents tulajdonságban lévő összes dokumentumot menteni szeretné.
- topLevelFilename
- String
A létrehozni vagy felülírni kívánt fájl neve, amely tartalmazza az összes mentett dokumentum térképét.
Válaszok
Az DiscoveryClientResultCollection összes mentett fájl eredményét tartalmazó fájl.
Példák
Az alábbi példakód egy webűrlap, amely a Web Services-felderítés eredményeit lemezre írja a metódus meghívásával a WriteAll hívásokat DiscoverAny követően.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;
}
// 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
Megjegyzések
A könyvtárparaméter által megadott könyvtárban a paraméter nevével topLevelFilename létrehozott fájl tartalmazza a mentett felderítési dokumentumok térképét, az XML-sémadefiníciós (XSD) sémákat és a szolgáltatás leírását. Ez a fájl beolvasható a metódussal a ReadAll tulajdonságok és References a tulajdonságok feltöltéséhezDocuments. A fájl formátuma XML, amely az DiscoveryClientProtocol.DiscoveryClientResultsFile osztály szerializált verzióját tartalmazza.
Ha egy fájl ugyanazzal a névvel rendelkezik, mint a topLevelFilenamedirectory paraméter, akkor a metódus felülírja a WriteAll fájlt. A topLevelFilename paraméternek tartalmaznia kell a teljes elérési utat, ha a fájl nem létezik az aktuális könyvtárban.