Export (0) Print
Expand All

DiscoveryClientProtocol.Errors Property

Gets a collection of exceptions that occurred during invocation of method from this class.

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

public DiscoveryExceptionDictionary Errors { get; }

The Errors collection is populated with exceptions that occurred during invocations to the Discover, DiscoverAny, ResolveAll, and ResolveOneLevel methods. The DiscoveryExceptionDictionary is cleared on invocation of these methods.

string myDiscoFile = "http://localhost/MathService_cs.vsdisco";
string myUrlKey = "http://localhost/MathService_cs.asmx?wsdl";
DiscoveryClientProtocol myDiscoveryClientProtocol = 
      new DiscoveryClientProtocol();

// Get the discovery document.
DiscoveryDocument myDiscoveryDocument = 
   myDiscoveryClientProtocol.Discover(myDiscoFile);
IEnumerator myEnumerator = 
      myDiscoveryDocument.References.GetEnumerator();
while ( myEnumerator.MoveNext() )
{
   ContractReference myContractReference =
      (ContractReference)myEnumerator.Current;

   // Get the DiscoveryClientProtocol from the ContractReference.
   myDiscoveryClientProtocol = myContractReference.ClientProtocol;
   myDiscoveryClientProtocol.ResolveAll();

   DiscoveryExceptionDictionary myExceptionDictionary 
      = myDiscoveryClientProtocol.Errors;

   if (myExceptionDictionary.Contains(myUrlKey))
   {
      Console.WriteLine("System generated exceptions.");

      // Get the exception from the DiscoveryExceptionDictionary.
      Exception myException = myExceptionDictionary[myUrlKey];

      Console.WriteLine(" Source : " + myException.Source);
      Console.WriteLine(" Exception : " + myException.Message);
   }
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft