This documentation is archived and is not being maintained.

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

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)
#using <mscorlib.dll>
#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>
using namespace System;
using namespace System::Web::Services::Discovery;
using namespace System::Net;
using namespace System::Xml;
using namespace System::Xml::Serialization;

int main()
   String* outputDirectory = S"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(S"http://localhost/MathService_cs.vsdisco");
      DiscoveryClientResultCollection* myCollection = 
         myClient->WriteAll(outputDirectory, S"MyDiscoMap.discomap");
      // Get the DiscoveryClientProtocol.DiscoveryClientResultsFile.
      DiscoveryClientProtocol::DiscoveryClientResultsFile* myResultFile =
         new DiscoveryClientProtocol::DiscoveryClientResultsFile();
      XmlSerializer* mySerializer = new XmlSerializer(myResultFile->GetType()); 
      XmlReader* reader = new XmlTextReader(S"http://localhost/MyDiscoMap.discomap");
      myResultFile = dynamic_cast<DiscoveryClientProtocol::DiscoveryClientResultsFile*>

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

      Console::WriteLine(S"Referred file(s): ");
      System::Collections::IEnumerator* myEnum = myResultcollection->GetEnumerator();
      while (myEnum->MoveNext())
         DiscoveryClientResult* myResult = __try_cast<DiscoveryClientResult*>(myEnum->Current);
   catch(Exception* e)


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

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0