DiscoveryClientProtocolmarshal by reference, disposable

System.Web.Services.Discovery (

Most types in this namespace are used for modeling discovery documents. This class provides the utility methods that allow you to reflect on URLs and create the appropriate discovery document objects. This class is based on two properties: Documents, which contains a collection of discovery documents, and References, which will contain a collection of disovery document references when the discovery process is complete.

To start the discovery process, you need to know the location of the discovery document you want to process (which could have been retrieved through a service like UDDI). You can then use the Discover( ) method and supply the appropriate URL as a string. (Alternatively, you can use the DiscoverAny( ) method if you are not sure whether the URL points to a discovery document, WSDL service description, or XSD file.) If the document is valid, the document will be added to the References and Documents collection. In addition, all references contained in the discovery document are added to the References collection, but they are not validated.

To verify the discovery document's references (the next stage of the discovery process), you should use the ResolveOneLevel( ) method, which moves through the References collection and ensures that all valid references are added to the Documents collection. Alternatively, you can use the ResolveAll( ) method, which will examine any nested discovery documents. For example, if you have a discovery document that references another discovery document, which references a third discovery document, the ResolveAll( ) method will burrow through all the levels. Errors found during the reference resolving process are not thrown and caught in your code, but added to the Errors collection. Additional information found in the discovery document (such as SOAP bindings) will be added to the AdditionalInformation collection.

The DiscoveryClientProtocol class also contains methods that let you download discovery documents to files on the client computer. You can use the Download( ) method to send the discovery document at a specified URL to a System.IO.Stream, and the WriteAll( ) method to write all discovery documents, XSD files, and Service Descriptions in the Documents property to the supplied directory. In this case, the file designated by the topLevelFileName argument is used to store a map of saved documents, which you can read to recreate the DiscoveryClientProtocol instance by using the ReadAll( ) method. The format used in this file is XML.

public class DiscoveryClientProtocol : System.Web.Services.Protocols.HttpWebClientProtocol {
// Public Constructors
   public DiscoveryClientProtocol( );
// Public Instance Properties
   public IList AdditionalInformation{get; }
   public DiscoveryClientDocumentCollection Documents{get; }
   public DiscoveryExceptionDictionary Errors{get; }
   public DiscoveryClientReferenceCollection References{get; }
// Public Instance Methods
   public DiscoveryDocument Discover(string url);
   public DiscoveryDocument DiscoverAny(string url);
   public Stream Download(ref string url);
   public Stream Download(ref string url, ref string contentType);
   public DiscoveryClientResultCollection ReadAll(string topLevelFilename);
   public void ResolveAll( );
   public void ResolveOneLevel( );
   public DiscoveryClientResultCollection WriteAll(string directory, string topLevelFilename);


System.Object System.MarshalByRefObject System.ComponentModel.Component(System.ComponentModel.IComponent, System.IDisposable) System.Web.Services.Protocols.WebClientProtocol System.Web.Services.Protocols.HttpWebClientProtocol DiscoveryClientProtocol

Returned By


Passed To


    Part I: Introduction to ASP.NET
    Part III: Namespace Reference
    Chapter 40. The System.Web.UI.MobileControls Namespace
    Chapter 42. The System.Web.UI.WebControls Namespace