This documentation is archived and is not being maintained.

DiscoveryClientProtocol.WriteAll Method

Writes all discovery documents, XML Schema Definition (XSD) schemas, and Service Descriptions in the Documents property to the supplied directory and creates a file in that directory.

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

[PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")]
public DiscoveryClientResultCollection WriteAll(
	string directory,
	string topLevelFilename


Type: System.String

The directory in which to save all documents currently in the Documents property.

Type: System.String

The name of the file to create or overwrite containing a map of all documents saved.

Return Value

Type: System.Web.Services.Discovery.DiscoveryClientResultCollection
A DiscoveryClientResultCollection containing the results of all files saved.

The file created with the name of the topLevelFilename parameter in the directory specified by the directory parameter contains a map of saved discovery documents, XML Schema Definition (XSD) schemas and service descriptions. This file can be read in using the ReadAll method to populate the References and Documents properties. The format of the file is XML containing an serialized version of the DiscoveryClientProtocol.DiscoveryClientResultsFile class.

If a file exists with the same name as the topLevelFilename parameter in the directory parameter, that file is overwritten by the WriteAll method. The topLevelFilename parameter must include the fully qualified path if the file does not exist in the current directory.

The following code example is a Web Form that writes the results of a Web Services discovery to disk by invoking the WriteAll method after calls to DiscoverAny and ResolveAll.

   protected void Discover_Click(object Source, EventArgs e)
	// Specify the URL to discover.
	string sourceUrl = DiscoURL.Text;
	// Specify the URL to save discovery results to or read from.
	string outputDirectory = DiscoDir.Text;

        DiscoveryClientProtocol client = new DiscoveryClientProtocol();
	// Use default credentials to access the URL being discovered.
        client.Credentials = CredentialCache.DefaultCredentials;

       	  DiscoveryDocument doc;

          // Discover the URL for any discoverable documents. 
	  doc = client.DiscoverAny(sourceUrl);
          // Resolve all possible references from the supplied URL.
        catch ( Exception e2) 
          Status.Text = e2.Message;

	// Save the discovery results to disk.
        DiscoveryClientResultCollection results = client.WriteAll(outputDirectory, "results.discomap");
        Status.Text = "The following file holds the links to each of the discovery results: <b>" + 
	                                Path.Combine(outputDirectory,"results.discomap") + "</b>";

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0