Edit

Bagikan melalui


MetadataExchangeClient Class

Definition

Downloads service metadata.

public ref class MetadataExchangeClient
public class MetadataExchangeClient
type MetadataExchangeClient = class
Public Class MetadataExchangeClient
Inheritance
MetadataExchangeClient

Examples

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);

Remarks

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:

Constructors

MetadataExchangeClient()

Initializes a new instance of the MetadataExchangeClient class.

MetadataExchangeClient(Binding)

Initializes a new instance of the MetadataExchangeClient class using the specified binding.

MetadataExchangeClient(EndpointAddress)

Initializes a new instance of the MetadataExchangeClient class.

MetadataExchangeClient(String)

Initializes a new instance of the MetadataExchangeClient class.

MetadataExchangeClient(Uri, MetadataExchangeClientMode)

Initializes a new instance of the MetadataExchangeClient class.

Properties

HttpCredentials

Gets or sets the credentials used to make an HTTP/GET request.

MaximumResolvedReferences

Gets or sets the maximum number of references to metadata that the MetadataExchangeClient downloads.

OperationTimeout

Gets or sets the period of time within which the metadata must be downloaded before an exception is thrown.

ResolveMetadataReferences

Gets or sets a value that controls whether references to metadata are resolved.

SoapCredentials

Gets or sets the client security credentials used to make a WS-Transfer metadata request.

Methods

BeginGetMetadata(AsyncCallback, Object)

Begins an asynchronous method call that returns a MetadataSet.

BeginGetMetadata(EndpointAddress, AsyncCallback, Object)

Begins an asynchronous method call that returns a MetadataSet using the specified address, callback, and asynchronous state.

BeginGetMetadata(Uri, MetadataExchangeClientMode, AsyncCallback, Object)

Begins an asynchronous method call that returns a MetadataSet using the specified address, callback, asynchronous state, and download mechanism.

EndGetMetadata(IAsyncResult)

Ends an asynchronous method call that returns a MetadataSet.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetChannelFactory(EndpointAddress, String, String)

When overridden in a derived class, returns the channel factory that is used to make the WS-Transfer metadata request.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetMetadata()

Returns a MetadataSet.

GetMetadata(EndpointAddress, Uri)

Returns a MetadataSet from the specified address and on the specified route.

GetMetadata(EndpointAddress)

Returns a MetadataSet from the specified address.

GetMetadata(Uri, MetadataExchangeClientMode)

Returns a MetadataSet from the specified address using the specified download mode.

GetMetadataAsync()

Returns an asynchronous metadata set.

GetMetadataAsync(EndpointAddress, Uri)

Returns an asynchronous metadata set from the specified address and on the specified route.

GetMetadataAsync(EndpointAddress)

Returns an asynchronous metadata set from the specified address.

GetMetadataAsync(Uri, MetadataExchangeClientMode)

Returns an asynchronous metadata set from the specified address using the specified download mode.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetWebRequest(Uri, String, String)

When overridden in a derived class, returns the HttpWebRequest used to make HTTP/GET metadata requests.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to