Export (0) Print
Expand All

DiscoveryClientProtocol.ReadAll Method

Reads in a file containing a map of saved discovery documents populating the Documents and References properties, with discovery documents, XML Schema Definition (XSD) schemas, and service descriptions referenced in the file.

[Visual Basic]
Public Function ReadAll( _
   ByVal topLevelFilename As String _
) As DiscoveryClientResultCollection
[C#]
public DiscoveryClientResultCollection ReadAll(
 string topLevelFilename
);
[C++]
public: DiscoveryClientResultCollection* ReadAll(
 String* topLevelFilename
);
[JScript]
public function ReadAll(
   topLevelFilename : String
) : DiscoveryClientResultCollection;

Parameters

topLevelFilename
Name of file to read in, containing the map of saved discovery documents.

Return Value

A DiscoveryClientResultCollection containing the results found in the file with the map of saved discovery documents. The file format is a DiscoveryClientProtocol.DiscoveryClientResultsFile class serialized into XML; however, one would typically create the file using only the WriteAll method or Disco.exe.

Remarks

A file containing a map of saved discovery documents can be created by the WriteAll method or Disco.exe.

The topLevelFilename parameter must include the fully qualified path if the file does not exist in the current directory.

Example

[Visual Basic, C#] The following code example is a Web Form that populates a DataGrid with the details about the documents and references found in an existing discovery map document using the ReadAll method.

[Visual Basic] 
Public Sub Discover_Click(Source As Object, e as EventArgs )
   ' Specify the URL to read the discovery results from.
   Dim outputDirectory As String = DiscoDir.Text

   Dim client as DiscoveryClientProtocol = new DiscoveryClientProtocol()
   ' Use default credentials to access files containing the previously saved discovery results.
   client.Credentials = CredentialCache.DefaultCredentials
   Try 
        Dim doc As DiscoveryDocument
  
    ' Read in existing discovery results.
     Dim results As DiscoveryClientResultCollection 
     results = client.ReadAll(Path.Combine(DiscoDir.Text,"results.discomap"))

   Catch e2 As Exception
          DiscoveryResultsGrid.Columns.Clear()
       Status.Text = e2.Message
   End Try

   ' If disocvery documents existed in the supplied folder, display the results in a data grid.
    If (client.Documents.Count > 0) Then
         ' Populate the data grid with the discovery results.
     PopulateGrid(client)
    End If
End Sub

[C#] 
protected void Discover_Click(object Source, EventArgs e)
{
 // Specify the URL to read the discovery results from.
 string outputDirectory = DiscoDir.Text;

     DiscoveryClientProtocol client = new DiscoveryClientProtocol();
 // Use default credentials to access the files containing the discovery results.
     client.Credentials = CredentialCache.DefaultCredentials;

     try {
          DiscoveryDocument doc;
   // Read in existing discovery results.
       DiscoveryClientResultCollection results = client.ReadAll(Path.Combine(DiscoDir.Text,"results.discomap"));
     }
     catch ( Exception e2) 
     {
       DiscoveryResultsGrid.Columns.Clear();
       Status.Text = e2.Message;
     }
 // If discovery documents existed in the supplied folder, display the results in a data grid.
     if (client.Documents.Count > 0)
     PopulateGrid(client);
  }

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

DiscoveryClientProtocol Class | DiscoveryClientProtocol Members | System.Web.Services.Discovery Namespace

Show:
© 2014 Microsoft