다음을 통해 공유


DiscoveryClientProtocol.DiscoveryClientResultsFile 클래스

정의

WriteAll(String, String) 메서드가 호출될 때 쓰여진 모든 파일의 결과를 포함하는 XML 문서의 루트 요소를 나타냅니다.

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

예제

#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

설명

호출 하는 경우는 DiscoveryClientProtocol.WriteAll 메서드, 해결 된 모든 검색 문서 및 해당 모든 파일에 대 한 지도가 포함 된 파일 디렉터리에 저장 됩니다. 맵 파일은 루트 요소는 XML에 설명 된 DiscoveryClientProtocol.DiscoveryClientResultsFile;이 클래스에 전달 되는 XmlSerializer 결과 serialize 하는 클래스입니다.

생성자

DiscoveryClientProtocol.DiscoveryClientResultsFile()

DiscoveryClientProtocol.DiscoveryClientResultsFile 클래스의 새 인스턴스를 초기화합니다.

속성

Results

DiscoveryClientResult 개체의 컬렉션입니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상