This documentation is archived and is not being maintained.

DiscoveryDocumentReference Class

Represents a reference to a discovery document. This class cannot be inherited.


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

public sealed class DiscoveryDocumentReference : DiscoveryReference

The DiscoveryDocumentReference type exposes the following members.

Public methodDiscoveryDocumentReference()Initializes a new instance of the DiscoveryDocumentReference class.
Public methodDiscoveryDocumentReference(String)Initializes a new instance of the DiscoveryDocumentReference class, setting the Ref property to the value of href.

Public propertyClientProtocolGets or sets the instance of DiscoveryClientProtocol used in a discovery process. (Inherited from DiscoveryReference.)
Public propertyDefaultFilenameGets the name of the default file to use when saving the referenced discovery document. (Overrides DiscoveryReference.DefaultFilename.)
Public propertyDocumentGets the contents of the referenced discovery document as a DiscoveryDocument object.
Public propertyRefGets or sets the reference to a discovery document.
Public propertyUrlGets or sets the URL of the referenced discovery document. (Overrides DiscoveryReference.Url.)

Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodReadDocumentReads and returns the discovery document from the passed Stream. (Overrides DiscoveryReference.ReadDocument(Stream).)
Public methodResolve()Downloads the referenced document at Url to resolve whether the referenced document is valid. (Inherited from DiscoveryReference.)
Protected methodResolve(String, Stream)Resolves whether the referenced document is valid. (Inherited from DiscoveryReference.)
Public methodResolveAllVerifies that all referenced documents within the discovery document are valid.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodWriteDocumentWrites the passed DiscoveryDocument into the passed Stream. (Overrides DiscoveryReference.WriteDocument(Object, Stream).)

XML Web services discovery involves discovering the available XML Web services given an URL. The URL typically points to a discovery document, which usually has a.disco file name extension. The discovery document contains references to information about the existance of XML Web services, such as Service Descriptions, XML Schema Definition language (XSD) schemas, or other discovery documents. This class represents a reference to a discovery document.

using System;
using System.Xml;
using System.Web.Services.Discovery;
using System.IO;
using System.Collections;

public class DiscoveryDocumentReference_ctor_WriteDocument
    public static void Main()
            DiscoveryDocument myDiscoveryDocument;
            XmlTextReader myXmlTextReader = 
                new XmlTextReader("http://localhost/Sample_cs.vsdisco");
            myDiscoveryDocument = DiscoveryDocument.Read(myXmlTextReader);

            // Create a new instance of DiscoveryDocumentReference.
            DiscoveryDocumentReference myDiscoveryDocumentReference = 
                new DiscoveryDocumentReference();
            FileStream myFileStream = new FileStream("Temp.vsdisco", 
                FileMode.OpenOrCreate, FileAccess.Write);
                myDiscoveryDocument, myFileStream);

            FileStream myFileStream1 = new FileStream("Temp.vsdisco", 
                FileMode.OpenOrCreate, FileAccess.Read);
            StreamReader myStreamReader = new StreamReader(myFileStream1);

            // Initialize the file pointer.
            myStreamReader.BaseStream.Seek(0, SeekOrigin.Begin);
            Console.WriteLine("The contents of the discovery document are: \n");
            while(myStreamReader.Peek() > -1)
                // Display the contents of the discovery document.
        catch(Exception e)
            Console.WriteLine("Exception: {0}", e.Message);

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

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