Export (0) Print
Expand All

DiscoveryClientResult Class

Represents the details of a discovery reference without the contents of the referenced document. This class cannot be inherited.

For a list of all members of this type, see DiscoveryClientResult Members.

System.Object
   System.Web.Services.Discovery.DiscoveryClientResult

[Visual Basic]
NotInheritable Public Class DiscoveryClientResult
[C#]
public sealed class DiscoveryClientResult
[C++]
public __gc __sealed class DiscoveryClientResult
[JScript]
public class DiscoveryClientResult

Thread Safety

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

Remarks

Using the WriteAll method of DiscoveryClientProtocol, all valid referenced documents and a file containing a map of all save documents can be written to disk. The file containing a map of all saved documents contains the details of each document as summarized by the properties of DiscoveryClientResult.

After the referenced documents and the map of the referenced documents have been written to disk using the WriteAll method, you can invoke the ReadAll method to read the discovery documents.

Example

[Visual Basic] 
Imports System
Imports System.Web.Services.Discovery

Public Class MyDiscoveryClientResult

    Shared Sub Main()
        Try
            Dim myDiscoveryClientProtocol As New DiscoveryClientProtocol()

            ' Get the collection holding DiscoveryClientResult objects.
            Dim myDiscoveryClientResultCollection As _
                DiscoveryClientResultCollection = _
                myDiscoveryClientProtocol.ReadAll("results.discomap")
            Console.WriteLine("The number of DiscoveryClientResult objects: " _
                & myDiscoveryClientResultCollection.Count.ToString())
            Console.WriteLine("Displaying the items in the collection:")

            ' Iterate through the collection and display the properties
            ' of each DiscoveryClientResult in it.
            Dim myDiscoveryClientResult As DiscoveryClientResult
            For Each myDiscoveryClientResult In myDiscoveryClientResultCollection
                Console.WriteLine( _
                    "Type of reference in the discovery document: " _
                    & myDiscoveryClientResult.ReferenceTypeName)
                Console.WriteLine("Url for the reference: " _
                    & myDiscoveryClientResult.Url)
                Console.WriteLine("File for saving the reference: " _
                    & myDiscoveryClientResult.Filename)
            Next myDiscoveryClientResult
        Catch e As Exception
            Console.WriteLine("Error is " + e.Message)
        End Try
    End Sub 'Main
End Class 'MyDiscoveryClientResult

[C#] 
using System;
using System.Web.Services.Discovery;
public class MyDiscoveryClientResult
{
    static void Main()
    {
        try
        {
            DiscoveryClientProtocol myDiscoveryClientProtocol = 
                new DiscoveryClientProtocol();

            // Get the collection holding DiscoveryClientResult objects.
            DiscoveryClientResultCollection myDiscoveryClientResultCollection = 
                myDiscoveryClientProtocol.ReadAll("results.discomap");
            Console.WriteLine("The number of DiscoveryClientResult objects: "
                + myDiscoveryClientResultCollection.Count);
            Console.WriteLine("Displaying the items in the collection:");

            // Iterate through the collection and display the properties
            // of each DiscoveryClientResult in it.
            foreach(DiscoveryClientResult myDiscoveryClientResult in 
                myDiscoveryClientResultCollection)
            {
                Console.WriteLine(
                    "Type of reference in the discovery document: "
                    + myDiscoveryClientResult.ReferenceTypeName);
                Console.WriteLine("Url for the reference: " 
                    + myDiscoveryClientResult.Url);
                Console.WriteLine("File for saving the reference: "
                    + myDiscoveryClientResult.Filename);
            }
        }
        catch(Exception e)
        {
            Console.WriteLine("Error is " + e.Message);
        }
    }
}

[C++] 
#using <mscorlib.dll>
#using <System.Web.Services.dll>
#using <System.dll>
using namespace System;
using namespace System::Web::Services::Discovery;

int main()
{
   try
   {
      DiscoveryClientProtocol* myDiscoveryClientProtocol =
         new DiscoveryClientProtocol();

      // Get the collection holding DiscoveryClientResult objects.
      DiscoveryClientResultCollection* myDiscoveryClientResultCollection =
         myDiscoveryClientProtocol->ReadAll(S"results.discomap");
      Console::WriteLine(S"The number of DiscoveryClientResult objects: {0}", __box(myDiscoveryClientResultCollection->Count));
      Console::WriteLine(S"Displaying the items in the collection:");

      // Iterate through the collection and display the properties
      // of each DiscoveryClientResult in it.
      System::Collections::IEnumerator* myEnum = myDiscoveryClientResultCollection->GetEnumerator();
      while (myEnum->MoveNext())
      {
         DiscoveryClientResult* myDiscoveryClientResult = __try_cast<DiscoveryClientResult*>(myEnum->Current);
         Console::WriteLine(
            S"Type of reference in the discovery document: {0}", myDiscoveryClientResult->ReferenceTypeName);
         Console::WriteLine(S"Url for the reference: {0}", myDiscoveryClientResult->Url);
         Console::WriteLine(S"File for saving the reference: {0}", myDiscoveryClientResult->Filename);
      }
   }
   catch(Exception* e)
   {
      Console::WriteLine(S"Error is {0}", e->Message);
   }
}

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

Requirements

Namespace: System.Web.Services.Discovery

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

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

See Also

DiscoveryClientResult Members | System.Web.Services.Discovery Namespace

Show:
© 2014 Microsoft