Share via


DiscoveryClientProtocol.WriteAll(String, String) Metoda

Definice

Zapíše všechny dokumenty zjišťování, schémata definice schématu XML (XSD) a popisy služby ve Documents vlastnosti do zadaného adresáře a vytvoří soubor v daném adresáři.

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 Documents aktuálně ve vlastnosti.

topLevelFilename
String

Název souboru, který se má vytvořit nebo přepsat, obsahující mapování 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 definice schémat XML (XSD) a popisy služby. Tento soubor lze přečíst v pomocí ReadAll metody k naplnění References vlastností a Documents . Formát souboru je XML obsahující serializovanou verzi DiscoveryClientProtocol.DiscoveryClientResultsFile třídy .

Pokud existuje soubor se stejným názvem jako topLevelFilename parametr v parametru directory , je tento soubor přepsán metodou WriteAll . Pokud topLevelFilename soubor v aktuálním adresáři neexistuje, musí parametr obsahovat plně kvalifikovanou cestu.

Platí pro

Viz také