Aracılığıyla paylaş


DiscoveryClientProtocol.WriteAll(String, String) Yöntem

Tanım

Özelliğindeki Documents tüm bulma belgelerini, XML Şema Tanımı (XSD) şemalarını ve Hizmet Açıklamalarını sağlanan dizine yazar ve bu dizinde bir dosya oluşturur.

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

Parametreler

directory
String

Şu anda Documents özelliğinde bulunan tüm belgelerin kaydedildiği dizin.

topLevelFilename
String

Kaydedilen tüm belgelerin haritasını içeren oluşturulacak veya üzerine yazılması gereken dosyanın adı.

Döndürülenler

DiscoveryClientResultCollection

DiscoveryClientResultCollection Kaydedilen tüm dosyaların sonuçlarını içeren.

Örnekler

Aşağıdaki kod örneği, ve ResolveAllçağrılarından sonra yöntemini çağırarak bir Web Hizmetleri bulma işleminin WriteAll sonuçlarını diske DiscoverAny yazan bir Web Formudur.

 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

Açıklamalar

Dizin parametresi tarafından belirtilen dizinde parametresinin topLevelFilename adıyla oluşturulan dosya, kaydedilmiş bulma belgelerinin, XML Şema Tanımı (XSD) şemalarının ve hizmet açıklamalarının bir eşlemesini içerir. Bu dosya, ve Documents özelliklerini doldurmak References için yöntemi kullanılarak ReadAll okunabilir. Dosyanın biçimi, sınıfının serileştirilmiş bir sürümünü içeren XML'dir DiscoveryClientProtocol.DiscoveryClientResultsFile .

parametresindeki parametreyle directory aynı ada topLevelFilename sahip bir dosya varsa, yöntemi bu WriteAll dosyanın üzerine yazılır. Dosya topLevelFilename geçerli dizinde yoksa parametresi tam yolu içermelidir.

Şunlara uygulanır

Ayrıca bkz.