DiscoveryDocumentReference.Document Property
Gets the contents of the referenced discovery document as a DiscoveryDocument object.
[Visual Basic] Public ReadOnly Property Document As DiscoveryDocument [C#] public DiscoveryDocument Document {get;} [C++] public: __property DiscoveryDocument* get_Document(); [JScript] public function get Document() : DiscoveryDocument;
Property Value
A DiscoveryDocument representing the contents of the referenced discovery document.
Exceptions
| Exception Type | Condition |
|---|---|
| InvalidOperationException | ClientProtocol property is a null reference (Nothing in Visual Basic).
-or- An error occurred during the download or resolution of the XSD schema using ClientProtocol. |
Remarks
If the discovery document has not been downloaded and added to the Documents property of ClientProtocol, an attempt to download and resolve the document is made.
Example
[Visual Basic] Dim myUrl As String = "http://localhost/Sample_vb.vsdisco" Dim myProtocol As New DiscoveryClientProtocol() ' Get the discovery document myDiscoveryDocument. Dim myDiscoveryDocument As DiscoveryDocument = myProtocol.Discover(myUrl) ' Get the references of myDiscoveryDocument. Dim myEnumerator As IEnumerator = myDiscoveryDocument.References.GetEnumerator() While myEnumerator.MoveNext() Dim myNewReference As DiscoveryDocumentReference = _ CType(myEnumerator.Current, DiscoveryDocumentReference) ' Set the ClientProtocol of myNewReference. Dim myNewProtocol As DiscoveryClientProtocol = myNewReference.ClientProtocol ' Verify for all the valid references. myNewReference.ResolveAll() ' Get the document of myNewReference. Dim myNewDiscoveryDocument As DiscoveryDocument = myNewReference.Document Dim myNewEnumerator As IEnumerator = _ myNewDiscoveryDocument.References.GetEnumerator() Console.WriteLine("The valid discovery document is : " + ControlChars.NewLine) While myNewEnumerator.MoveNext() ' Display the references of myNewDiscoveryDocument on the console. Console.WriteLine(CType(myNewEnumerator.Current, DiscoveryDocumentReference).Ref) End While End While [C#] string myUrl = "http://localhost/Sample_cs.vsdisco"; DiscoveryClientProtocol myProtocol = new DiscoveryClientProtocol(); // Get the discovery document myDiscoveryDocument. DiscoveryDocument myDiscoveryDocument = myProtocol.Discover(myUrl); // Get the references of myDiscoveryDocument. IEnumerator myEnumerator = myDiscoveryDocument.References.GetEnumerator(); while(myEnumerator.MoveNext()) { DiscoveryDocumentReference myNewReference = (DiscoveryDocumentReference)myEnumerator.Current; // Set the ClientProtocol of myNewReference. DiscoveryClientProtocol myNewProtocol = myNewReference.ClientProtocol; // Verify for all the valid references. myNewReference.ResolveAll(); // Get the document of myNewReference. DiscoveryDocument myNewDiscoveryDocument = myNewReference.Document; IEnumerator myNewEnumerator = myNewDiscoveryDocument.References.GetEnumerator(); Console.WriteLine("The valid discovery document is : \n"); while(myNewEnumerator.MoveNext()) { // Display the references of myNewDiscoveryDocument on the console. Console.WriteLine(((DiscoveryDocumentReference)myNewEnumerator.Current).Ref); } } [C++] String* myUrl = S"http://localhost/Sample_cs.vsdisco"; DiscoveryClientProtocol* myProtocol = new DiscoveryClientProtocol(); // Get the discovery document myDiscoveryDocument. DiscoveryDocument* myDiscoveryDocument = myProtocol->Discover(myUrl); // Get the references of myDiscoveryDocument. IEnumerator* myEnumerator = myDiscoveryDocument->References->GetEnumerator(); while(myEnumerator->MoveNext()) { DiscoveryDocumentReference* myNewReference = dynamic_cast<DiscoveryDocumentReference*>(myEnumerator->Current); // Set the ClientProtocol of myNewReference. DiscoveryClientProtocol* myNewProtocol = myNewReference->ClientProtocol; // Verify for all the valid references. myNewReference->ResolveAll(); // Get the document of myNewReference. DiscoveryDocument* myNewDiscoveryDocument = myNewReference->Document; IEnumerator* myNewEnumerator = myNewDiscoveryDocument->References->GetEnumerator(); Console::WriteLine(S"The valid discovery document is : \n"); while(myNewEnumerator->MoveNext()) { // Display the references of myNewDiscoveryDocument on the console. Console::WriteLine((dynamic_cast<DiscoveryDocumentReference*>(myNewEnumerator->Current))->Ref); } }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
DiscoveryDocumentReference Class | DiscoveryDocumentReference Members | System.Web.Services.Discovery Namespace