This documentation is archived and is not being maintained.

DiscoveryDocumentReference Class

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

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


[Visual Basic]
NotInheritable Public Class DiscoveryDocumentReference
   Inherits DiscoveryReference
public sealed class DiscoveryDocumentReference : DiscoveryReference
public __gc __sealed class DiscoveryDocumentReference : public
public class DiscoveryDocumentReference extends DiscoveryReference

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.


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.


[Visual Basic] 
Imports System
Imports System.Xml
Imports System.Web.Services.Discovery
Imports System.IO
Imports System.Collections
Imports MicroSoft.VisualBasic

Public Class DiscoveryDocumentReference_ctor_WriteDocument

    Public Shared Sub Main()
            Dim myDiscoveryDocument As DiscoveryDocument
            Dim myXmlTextReader As _
                 New XmlTextReader("http://localhost/Sample_vb.vsdisco")
            myDiscoveryDocument = DiscoveryDocument.Read(myXmlTextReader)

            ' Create a new instance of DiscoveryDocumentReference.
            Dim myDiscoveryDocumentReference As _
                New DiscoveryDocumentReference()
            Dim myFileStream As New FileStream("Temp.vsdisco", _
                 FileMode.OpenOrCreate, FileAccess.Write)
            myDiscoveryDocumentReference.WriteDocument( _
                 myDiscoveryDocument, myFileStream)

            Dim myFileStream1 As New FileStream("Temp.vsdisco", _
                FileMode.OpenOrCreate, FileAccess.Read)
            Dim myStreamReader As New StreamReader(myFileStream1)

            ' Initialize the file pointer.
            myStreamReader.BaseStream.Seek(0, SeekOrigin.Begin)
            Console.WriteLine("The contents of the discovery document are: " _
                & ControlChars.NewLine)
            While myStreamReader.Peek() > - 1
                ' Display the contents of the discovery document.
            End While
        Catch e As Exception
            Console.WriteLine("Exception: {0}", e.Message.ToString())
        End Try
    End Sub 'Main
End Class 'DiscoveryDocumentReference_ctor_WriteDocument

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

#using <mscorlib.dll>
#using <System.Web.Services.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Xml;
using namespace System::Web::Services::Discovery;
using namespace System::IO;
using namespace System::Collections;

int main() 
        DiscoveryDocument* myDiscoveryDocument;
        XmlTextReader* myXmlTextReader =
            new XmlTextReader(S"http://localhost/Sample_cs::vsdisco");
        myDiscoveryDocument = DiscoveryDocument::Read(myXmlTextReader);

        // Create a new instance of DiscoveryDocumentReference.
        DiscoveryDocumentReference* myDiscoveryDocumentReference =
            new DiscoveryDocumentReference();
        FileStream* myFileStream = new FileStream(S"Temp::vsdisco", 
            FileMode::OpenOrCreate, FileAccess::Write);
            myDiscoveryDocument, myFileStream);
        FileStream* myFileStream1 =
            new FileStream(S"Temp::vsdisco", 
            FileMode::OpenOrCreate, FileAccess::Read);
        StreamReader* myStreamReader = new StreamReader(myFileStream1);

        // Initialize the file pointer.
        myStreamReader->BaseStream->Seek(0, SeekOrigin::Begin);
        Console::WriteLine(S"The contents of the discovery document are: \n");
        while(myStreamReader->Peek() > -1) 
            // Display the contents of the discovery document.
    catch (Exception* e) 
        Console::WriteLine(S"Exception: {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.


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

DiscoveryDocumentReference Members | System.Web.Services.Discovery Namespace | DiscoveryReference | DiscoveryDocument | DiscoveryClientProtocol