Export (0) Print
Expand All

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
public final class DiscoveryDocumentReference extends DiscoveryReference
public final class DiscoveryDocumentReference extends DiscoveryReference
Not applicable.

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);
        }
    }
}

import System.*;
import System.Xml.*;
import System.Web.Services.Discovery.*;
import System.IO.*;
import System.Collections.*;

public class DiscoveryDocumentReferenceCtorWriteDocument
{
    public static void main(String[] args)
    {
        try {
            DiscoveryDocument myDiscoveryDocument;
            XmlTextReader myXmlTextReader = 
                new XmlTextReader("http://localhost/Sample_jsl.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.get_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 (System.Exception e) {
            Console.WriteLine("Exception: {0}", e.get_Message());
        }
    } //main
} //DiscoveryDocumentReferenceCtorWriteDocument

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

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

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft