MetadataExchangeClient Constructor (Uri, MetadataExchangeClientMode)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Initializes a new instance of the MetadataExchangeClient class.

Namespace:   System.ServiceModel.Description
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public MetadataExchangeClient(
	Uri address,
	MetadataExchangeClientMode mode
)

Parameters

address
Type: System.Uri

The address of the metadata.

mode
Type: System.ServiceModel.Description.MetadataExchangeClientMode

The mode to use when downloading the metadata.

Use this constructor to specify the address and whether to use an HTTP GET request or WS-Transfer Get. For more information, seeSystem.ServiceModel.Description.MetadataExchangeClientMode.

The following code example shows the use of MetadataExchangeClient to specify a download binding, resolve any contained references to metadata, and download the metadata.

// Get metadata documents.
Console.WriteLine("URI of the metadata documents retreived:");
MetadataExchangeClient metaTransfer 
  = new MetadataExchangeClient(httpGetMetaAddress.Uri, MetadataExchangeClientMode.HttpGet);
metaTransfer.ResolveMetadataReferences = true;
MetadataSet otherDocs = metaTransfer.GetMetadata();
foreach (MetadataSection doc in otherDocs.MetadataSections)
  Console.WriteLine(doc.Dialect + " : " + doc.Identifier);

.NET Framework
Available since 3.0
Return to top
Show: