DiscoveryDocument Class

 

Represents 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.DiscoveryDocument

Public NotInheritable Class DiscoveryDocument

NameDescription
System_CAPS_pubmethodDiscoveryDocument()

Initializes a new instance of the DiscoveryDocument class.

NameDescription
System_CAPS_pubpropertyReferences

A list of references contained within the discovery document.

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticCanRead(XmlReader)

Returns a value indicating whether the passed XmlReader can be deserialized into a DiscoveryDocument.

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_pubmethodSystem_CAPS_staticRead(Stream)

Reads and returns a DiscoveryDocument from the passed Stream.

System_CAPS_pubmethodSystem_CAPS_staticRead(TextReader)

Reads and returns a DiscoveryDocument from the passed TextReader.

System_CAPS_pubmethodSystem_CAPS_staticRead(XmlReader)

Reads and returns a DiscoveryDocument from the passed XmlReader.

System_CAPS_pubmethodToString()

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

System_CAPS_pubmethodWrite(Stream)

Writes this DiscoveryDocument into the passed Stream.

System_CAPS_pubmethodWrite(TextWriter)

Writes this DiscoveryDocument into the passed TextWriter.

System_CAPS_pubmethodWrite(XmlWriter)

Writes this DiscoveryDocument into the passed XmlWriter.

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticNamespace

Namespace of the discovery XML element of a discovery document.

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, which is an XML document, contains references to information about the existance of XML Web services, such as a service description, XML Schema Definition (XSD) language schema, or another discovery document. This class represents the contents of the discovery document; where the References property contains a list of the references contained within the discovery document.

The following code example reads a discovery document from a file using the Read and writes it back out to file using the Write method.

Imports System
Imports System.Xml
Imports System.IO
Imports System.Web.Services.Discovery
Imports System.Collections


Public Class DiscoveryDocument_Example

   Shared Sub Main()
      Try
         ' Create an object of the 'DiscoveryDocument'.
         Dim myDiscoveryDocument As New DiscoveryDocument()

         ' Create an XmlTextReader with the sample file.
         Dim myXmlTextReader As New XmlTextReader("http://localhost/example_vb.disco")

         ' Read the given XmlTextReader.
         myDiscoveryDocument = DiscoveryDocument.Read(myXmlTextReader)

         ' Write the DiscoveryDocument into the 'TextWriter'.
         Dim myFileStream As New FileStream("log.txt", FileMode.OpenOrCreate, FileAccess.Write)
         Dim myStreamWriter As New StreamWriter(myFileStream)
         myDiscoveryDocument.Write(myStreamWriter)

         myStreamWriter.Flush()
         myStreamWriter.Close()
         ' Display the contents of the DiscoveryDocument onto the console.
         Dim myFileStream1 As New FileStream("log.txt", FileMode.OpenOrCreate, FileAccess.Read)
         Dim myStreamReader As New StreamReader(myFileStream1)

         ' Set the file pointer to the begin.
         myStreamReader.BaseStream.Seek(0, SeekOrigin.Begin)
         Console.WriteLine("The contents of the DiscoveryDocument are-")
         While myStreamReader.Peek() > - 1
            Console.WriteLine(myStreamReader.ReadLine())
         End While
         myStreamReader.Close()
      Catch e As Exception
         Console.WriteLine("Exception raised : {0}", e.Message.ToString())
      End Try
   End Sub 'Main
End Class 'DiscoveryDocument_Example

.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: