Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
DiscoveryClientProtocol.DiscoveryClientResultsFile Class

DiscoveryClientProtocol.DiscoveryClientResultsFile Class

Represents the root element of an XML document containing the results of all files written when the WriteAll method is invoked.


Namespace:  System.Web.Services.Discovery
Assembly:  System.Web.Services (in System.Web.Services.dll)

public sealed class DiscoveryClientResultsFile

The DiscoveryClientProtocol.DiscoveryClientResultsFile type exposes the following members.

Public methodDiscoveryClientProtocol.DiscoveryClientResultsFileInitializes a new instance of the DiscoveryClientProtocol.DiscoveryClientResultsFile class.

Public propertyResultsGets a collection of DiscoveryClientResult objects.

Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

When you invoke the DiscoveryClientProtocol.WriteAll method, all resolved discovery documents and a file containing a map of all those files are saved to a directory. The map file is described in XML with the root element being DiscoveryClientProtocol.DiscoveryClientResultsFile; this class is passed to the XmlSerializer class to serialize the results.

using System;
using System.Web.Services.Discovery;
using System.Net;
using System.Xml;
using System.Xml.Serialization;

class myDiscoveryClient_Results
   static void Main()
      string outputDirectory = "c:\\InetPub\\wwwroot";
      DiscoveryClientProtocol myClient = new DiscoveryClientProtocol();

      //  Use default credentials to access the URL being discovered.
      myClient.Credentials = CredentialCache.DefaultCredentials;
         DiscoveryDocument myDocument;

         // Discover the supplied URL to determine if it is a discovery document.
         myDocument = myClient.Discover("http://localhost/MathService_cs.vsdisco");
         DiscoveryClientResultCollection myCollection = 
             myClient.WriteAll(outputDirectory, "MyDiscoMap.discomap");
         // Get the DiscoveryClientProtocol.DiscoveryClientResultsFile.
         DiscoveryClientProtocol.DiscoveryClientResultsFile myResultFile =
             new DiscoveryClientProtocol.DiscoveryClientResultsFile();
         XmlSerializer mySerializer = new XmlSerializer(myResultFile.GetType()); 
         XmlReader reader = new XmlTextReader("http://localhost/MyDiscoMap.discomap");
         myResultFile = (DiscoveryClientProtocol.DiscoveryClientResultsFile)

         // Get a collection of DiscoveryClientResult objects.
         DiscoveryClientResultCollection myResultcollection = myResultFile.Results;

         Console.WriteLine("Referred file(s): ");
         foreach(DiscoveryClientResult myResult in myResultcollection)
      catch(Exception e)

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2015 Microsoft