EN
Deze inhoud is niet beschikbaar in uw taal, maar wel in het Engels.

DiscoveryDocumentReference.ResolveAll Method ()

 

Verifies that all referenced documents within the discovery document are valid.

Namespace:   System.Web.Services.Discovery
Assembly:  System.Web.Services (in System.Web.Services.dll)

public void ResolveAll()

Exception Condition
InvalidOperationException

The ClientProtocol property is null.

-or-

The discovery document could not be downloaded and verified successfully.

Unless you specifically need to resolve the individual references of a DiscoveryDocumentReference object, you should invoke the ResolveAll or ResolveOneLevel methods of DiscoveryClientProtocol.

This method resolves all references to discovery documents, XSD schemas, and Service Descriptions in the References property of ClientProtocol and any references found in referring discovery documents.

using System;
using System.Web.Services.Discovery;
using System.Collections;
using System.Security.Permissions;

class DiscoveryDocumentReference_Document_ResolveAll
{
   static void Main()
   {

      Run();
   }

   [PermissionSetAttribute(SecurityAction.Demand, Name="FullTrust")]
   static void Run()
   {
      try
      {
         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);
            }
         }
      }
      catch(Exception e)
      {
         Console.WriteLine("Exception :{0}", e.Message);
      }
   }
}

.NET Framework
Available since 1.1
Return to top
Weergeven: