DiscoveryClientProtocol.DiscoveryClientResultsFile Klasse

Definition

Stellt das Stammelement eines XML-Dokuments dar, das die Ergebnisse aller Dateien enthält, die beim Aufrufen der WriteAll(String, String)-Methode geschrieben wurden.

public: ref class DiscoveryClientProtocol::DiscoveryClientResultsFile sealed
public sealed class DiscoveryClientProtocol.DiscoveryClientResultsFile
type DiscoveryClientProtocol.DiscoveryClientResultsFile = class
Public NotInheritable Class DiscoveryClientProtocol.DiscoveryClientResultsFile
Vererbung
DiscoveryClientProtocol.DiscoveryClientResultsFile

Beispiele

#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 = "c:\\InetPub\\wwwroot";
   DiscoveryClientProtocol^ myClient = gcnew DiscoveryClientProtocol;

   //  Use default credentials to access the URL being discovered.
   myClient->Credentials = CredentialCache::DefaultCredentials;
   try
   {
      DiscoveryDocument^ myDocument;

      // Discover the supplied URL to determine if it is a discovery document.
      myDocument = myClient->Discover( "http://localhost/MathService_cs.vsdisco" );
      myClient->ResolveAll();
      DiscoveryClientResultCollection^ myCollection = myClient->WriteAll( outputDirectory, "MyDiscoMap.discomap" );

      // Get the DiscoveryClientProtocol.DiscoveryClientResultsFile.
      DiscoveryClientProtocol::DiscoveryClientResultsFile ^ myResultFile = gcnew DiscoveryClientProtocol::DiscoveryClientResultsFile;
      XmlSerializer^ mySerializer = gcnew XmlSerializer( myResultFile->GetType() );
      XmlReader^ reader = gcnew XmlTextReader( "http://localhost/MyDiscoMap.discomap" );
      myResultFile = dynamic_cast<DiscoveryClientProtocol::DiscoveryClientResultsFile^>(mySerializer->Deserialize( reader ));

      // Get a collection of DiscoveryClientResult objects.
      DiscoveryClientResultCollection^ myResultcollection = myResultFile->Results;
      Console::WriteLine( "Referred file(s): " );
      System::Collections::IEnumerator^ myEnum = myResultcollection->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         DiscoveryClientResult^ myResult = safe_cast<DiscoveryClientResult^>(myEnum->Current);
         Console::WriteLine( myResult->Filename );
      }
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( e->Message );
   }
}
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;
      try
      {
         DiscoveryDocument myDocument;

         // Discover the supplied URL to determine if it is a discovery document.
         myDocument = myClient.Discover("http://localhost/MathService_cs.vsdisco");
         myClient.ResolveAll();
         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)
             mySerializer.Deserialize(reader);

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

         Console.WriteLine("Referred file(s): ");
         foreach(DiscoveryClientResult myResult in myResultcollection)
         {
             Console.WriteLine(myResult.Filename);
         }
      }
      catch(Exception e)
      {
          Console.WriteLine(e.Message);
      }
   }
}
Imports System.Web.Services.Discovery
Imports System.Net
Imports System.Xml
Imports System.Xml.Serialization

Class myDiscoveryClient_Results
   
   Shared Sub Main()
      Dim outputDirectory As String = "c:\InetPub\wwwroot"
      Dim myClient As New DiscoveryClientProtocol()
      
      ' Use default credentials to access the URL being discovered.
      myClient.Credentials = CredentialCache.DefaultCredentials
      Try
          Dim myDocument As DiscoveryDocument
          ' Discover the supplied URL to determine if it is a discovery document.
          myDocument = myClient.Discover("http://localhost/MathService_vb.vsdisco")
          myClient.ResolveAll()
          Dim myCollection As DiscoveryClientResultCollection = _ 
              myClient.WriteAll(outputDirectory, "MyDiscoMap.discomap")
         ' Get the DiscoveryClientProtocol.DiscoveryClientResultsFile.
         Dim myResultFile As New DiscoveryClientProtocol.DiscoveryClientResultsFile()
         Dim mySerializer As New XmlSerializer(myResultFile.GetType())
         Dim reader = New XmlTextReader("http://localhost/MyDiscoMap.discomap")
         myResultFile = CType(mySerializer.Deserialize(reader), _ 
             DiscoveryClientProtocol.DiscoveryClientResultsFile)

         ' Get a collection of 'DiscoveryClientResult' objects.
         Dim myResultcollection As DiscoveryClientResultCollection = _
             myResultFile.Results

         Console.WriteLine("Referred file(s) : ")
         Dim myResult As DiscoveryClientResult
         For Each myResult In  myResultcollection
            Console.WriteLine(myResult.Filename)
         Next myResult
      Catch e As Exception
         Console.WriteLine(e.Message)
      End Try
   End Sub
End Class

Hinweise

Wenn Sie die DiscoveryClientProtocol.WriteAll Methode aufrufen, werden alle aufgelösten Ermittlungsdokumente und eine Datei mit einer Zuordnung aller dateien in einem Verzeichnis gespeichert. Die Kartendatei wird in XML beschrieben, wobei das Stammelement DiscoveryClientProtocol.DiscoveryClientResultsFilevorhanden ist; diese Klasse wird an die Klasse übergeben, um die XmlSerializer Ergebnisse zu serialisieren.

Konstruktoren

DiscoveryClientProtocol.DiscoveryClientResultsFile()

Initialisiert eine neue Instanz der DiscoveryClientProtocol.DiscoveryClientResultsFile-Klasse.

Eigenschaften

Results

Ruft eine Auflistung von DiscoveryClientResult-Objekten ab.

Methoden

Equals(Object)

Bestimmt, ob das angegebene Objekt gleich dem aktuellen Objekt ist.

(Geerbt von Object)
GetHashCode()

Fungiert als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Gilt für