DiscoveryDocumentReference Class

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)

System.Object
  System.Web.Services.Discovery.DiscoveryReference
    System.Web.Services.Discovery.DiscoveryDocumentReference

public sealed class DiscoveryDocumentReference : DiscoveryReference

NameDescription
System_CAPS_pubmethodDiscoveryDocumentReference()

Initializes a new instance of the DiscoveryDocumentReference class.

System_CAPS_pubmethodDiscoveryDocumentReference(String)

Initializes a new instance of the DiscoveryDocumentReference class, setting the Ref property to the value of href.

NameDescription
System_CAPS_pubpropertyClientProtocol

Gets or sets the instance of DiscoveryClientProtocol used in a discovery process.(Inherited from DiscoveryReference.)

System_CAPS_pubpropertyDefaultFilename

Gets the name of the default file to use when saving the referenced discovery document.(Overrides DiscoveryReference.DefaultFilename.)

System_CAPS_pubpropertyDocument

Gets the contents of the referenced discovery document as a DiscoveryDocument object.

System_CAPS_pubpropertyRef

Gets or sets the reference to a discovery document.

System_CAPS_pubpropertyUrl

Gets or sets the URL of the referenced discovery document.(Overrides DiscoveryReference.Url.)

NameDescription
System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodReadDocument(Stream)

Reads and returns the discovery document from the passed Stream.(Overrides DiscoveryReference.ReadDocument(Stream).)

System_CAPS_pubmethodResolve()

Downloads the referenced document at Url to resolve whether the referenced document is valid.(Inherited from DiscoveryReference.)

System_CAPS_protmethodResolve(String, Stream)

Resolves whether the referenced document is valid.(Inherited from DiscoveryReference.)

System_CAPS_pubmethodResolveAll()

Verifies that all referenced documents within the discovery document are valid.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodWriteDocument(Object, Stream)

Writes 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()
    {
        try
        {
            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);
            myDiscoveryDocumentReference.WriteDocument(
                myDiscoveryDocument, myFileStream);
            myFileStream.Close();

            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.
                Console.WriteLine(myStreamReader.ReadLine());
            }
            myStreamReader.Close();
        }
        catch(Exception e)
        {
            Console.WriteLine("Exception: {0}", e.Message);
        }
    }
}

.NET Framework
Available since 1.1

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

Return to top
Show:
© 2016 Microsoft