Export (0) Print
Expand All

MetadataExchangeClient Class

Downloads service metadata.

System.Object
  System.ServiceModel.Description.MetadataExchangeClient

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

public class MetadataExchangeClient

The MetadataExchangeClient type exposes the following members.

  NameDescription
Public methodMetadataExchangeClient()Initializes a new instance of the MetadataExchangeClient class.
Public methodMetadataExchangeClient(Binding)Initializes a new instance of the MetadataExchangeClient class using the specified binding.
Public methodMetadataExchangeClient(EndpointAddress)Initializes a new instance of the MetadataExchangeClient class.
Public methodMetadataExchangeClient(String)Initializes a new instance of the MetadataExchangeClient class.
Public methodMetadataExchangeClient(Uri, MetadataExchangeClientMode)Initializes a new instance of the MetadataExchangeClient class.
Top

  NameDescription
Public propertyHttpCredentialsGets or sets the credentials used to make an HTTP/GET request.
Public propertyMaximumResolvedReferencesGets or sets the maximum number of references to metadata that the MetadataExchangeClient downloads.
Public propertyOperationTimeoutGets or sets the period of time within which the metadata must be downloaded before an exception is thrown.
Public propertyResolveMetadataReferencesGets or sets a value that controls whether references to metadata are resolved.
Public propertySoapCredentialsGets or sets the client security credentials used to make a WS-Transfer metadata request.
Top

  NameDescription
Public methodBeginGetMetadata(AsyncCallback, Object)Begins an asynchronous method call that returns a MetadataSet.
Public methodBeginGetMetadata(EndpointAddress, AsyncCallback, Object)Begins an asynchronous method call that returns a MetadataSet using the specified address, callback, and asynchronous state.
Public methodBeginGetMetadata(Uri, MetadataExchangeClientMode, AsyncCallback, Object)Begins an asynchronous method call that returns a MetadataSet using the specified address, callback, asynchronous state, and download mechanism.
Public methodEndGetMetadataEnds an asynchronous method call that returns a MetadataSet.
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Protected methodGetChannelFactoryWhen overridden in a derived class, returns the channel factory that is used to make the WS-Transfer metadata request.
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetMetadata()Returns a MetadataSet.
Public methodGetMetadata(EndpointAddress)Returns a MetadataSet from the specified address.
Public methodGetMetadata(EndpointAddress, Uri)Returns a MetadataSet from the specified address and on the specified route.
Public methodGetMetadata(Uri, MetadataExchangeClientMode)Returns a MetadataSet from the specified address using the specified download mode.
Public methodGetMetadataAsync()Returns an asynchronous metadata set.
Public methodGetMetadataAsync(EndpointAddress)Returns an asynchronous metadata set from the specified address.
Public methodGetMetadataAsync(EndpointAddress, Uri)Returns an asynchronous metadata set from the specified address and on the specified route.
Public methodGetMetadataAsync(Uri, MetadataExchangeClientMode)Returns an asynchronous metadata set from the specified address using the specified download mode.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodGetWebRequestWhen overridden in a derived class, returns the HttpWebRequest used to make HTTP/GET metadata requests.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

Use the MetadataExchangeClient to download metadata. Typically, a MetadataExchangeClient is configured for a metadata request and then passed to the MetadataResolver.Resolve or MetadataResolver.Resolve method for the MetadataResolver to use to download metadata.

However, you can use the MetadataExchangeClient directly to retrieve metadata as a MetadataSet that contains MetadataSection objects.

Whether used directly or passed to a MetadataResolver, MetadataExchangeClient has the following members to control the metadata download process:

  • Use the constructors to customize the binding to use when making the metadata request.

  • Use the HttpCredentials property to specify the credentials used to make an HTTP/GET request.

  • Use the SoapCredentials property to specify the credentials used to make a WS-Transfer metadata request.

  • Use the MaximumResolvedReferences property to limit the number of metadata references the MetadataExchangeClient resolves.

  • Use the OperationTimeout property to limit the time spent retrieving metadata.

  • Use the ResolveMetadataReferences property to specify whether to locate and retrieve other metadata documents referred to by the metadata downloaded from the original metadata endpoint.

  • Use the GetMetadata methods to begin the downloading process.

In addition, you can create a derived class that can override the following two protected methods:

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

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft