DiscoveryDocument Class
Represents a discovery document. This class cannot be inherited.
Assembly: System.Web.Services (in System.Web.Services.dll)
The DiscoveryDocument type exposes the following members.
| Name | Description | |
|---|---|---|
![]() ![]() | CanRead | Returns a value indicating whether the passed XmlReader can be deserialized into a DiscoveryDocument. |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() ![]() | Read(Stream) | Reads and returns a DiscoveryDocument from the passed Stream. |
![]() ![]() | Read(TextReader) | Reads and returns a DiscoveryDocument from the passed TextReader. |
![]() ![]() | Read(XmlReader) | Reads and returns a DiscoveryDocument from the passed XmlReader. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | Write(Stream) | Writes this DiscoveryDocument into the passed Stream. |
![]() | Write(TextWriter) | Writes this DiscoveryDocument into the passed TextWriter. |
![]() | Write(XmlWriter) | Writes this DiscoveryDocument into the passed XmlWriter. |
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.
#using <System.Xml.dll> #using <System.Web.Services.dll> using namespace System; using namespace System::Xml; using namespace System::IO; using namespace System::Web::Services::Discovery; using namespace System::Collections; int main() { try { // Create an Object* of the 'DiscoveryDocument'. DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; // Create an XmlTextReader with the sample file. XmlTextReader^ myXmlTextReader = gcnew XmlTextReader( "http://localhost/example_cs.disco" ); // Read the given XmlTextReader. myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); // Write the DiscoveryDocument into the 'TextWriter'. FileStream^ myFileStream = gcnew FileStream( "log.txt",FileMode::OpenOrCreate,FileAccess::Write ); StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); myDiscoveryDocument->Write( myStreamWriter ); myStreamWriter->Flush(); myStreamWriter->Close(); // Display the contents of the DiscoveryDocument onto the console. FileStream^ myFileStream1 = gcnew FileStream( "log.txt",FileMode::OpenOrCreate,FileAccess::Read ); StreamReader^ myStreamReader = gcnew 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() ); } myStreamReader->Close(); } catch ( Exception^ e ) { Console::WriteLine( "Exception raised : {0}", e->Message ); } }
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.




