DiscoveryClientProtocol.WriteAll(String, String) Metoda
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Zapíše všechny dokumenty zjišťování, schémata XSD (XML Schema Definition) a popisy služby ve Documents vlastnosti do zadaného adresáře a vytvoří v daném adresáři soubor.
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
Parametry
- directory
- String
Adresář, do kterého chcete uložit všechny dokumenty, které jsou aktuálně ve Documents vlastnosti.
- topLevelFilename
- String
Název souboru, který se má vytvořit nebo přepsat obsahující mapu všech uložených dokumentů.
Návraty
A DiscoveryClientResultCollection obsahující výsledky všech uložených souborů.
Příklady
Následující příklad kódu je webový formulář, který zapisuje výsledky zjišťování webových služeb na disk vyvoláním WriteAll metody po volání DiscoverAny a 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
Poznámky
Soubor vytvořený s názvem parametru topLevelFilename v adresáři určeném parametrem adresáře obsahuje mapu uložených dokumentů zjišťování, schémat XML Schema Definition (XSD) a popisy služeb. Tento soubor lze číst pomocí ReadAll metody pro naplnění References vlastností a Documents vlastností. Formát souboru je XML obsahující serializovanou verzi DiscoveryClientProtocol.DiscoveryClientResultsFile třídy.
Pokud soubor existuje se stejným názvem jako topLevelFilename parametr v parametru directory , tento soubor je přepsán metodou WriteAll . Parametr topLevelFilename musí obsahovat plně kvalifikovanou cestu, pokud soubor v aktuálním adresáři neexistuje.