編輯

共用方式為


MetadataExchangeClient Constructors

Definition

Initializes a new instance of the MetadataExchangeClient class.

Overloads

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.

Remarks

The following table lists the default bindings that are used for various protocol schemes.

Scheme Binding
http WSHttpBinding (SecurityMode.None)
https WSHttpBinding (SecurityMode.Transport)
net.tcp CustomBinding with a TcpTransportBindingElement
net.pipe CustomBinding with a NamedPipeTransportBindingElement

MetadataExchangeClient()

Initializes a new instance of the MetadataExchangeClient class.

public:
 MetadataExchangeClient();
public MetadataExchangeClient ();
Public Sub New ()

Applies to

MetadataExchangeClient(Binding)

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

public:
 MetadataExchangeClient(System::ServiceModel::Channels::Binding ^ mexBinding);
public MetadataExchangeClient (System.ServiceModel.Channels.Binding mexBinding);
new System.ServiceModel.Description.MetadataExchangeClient : System.ServiceModel.Channels.Binding -> System.ServiceModel.Description.MetadataExchangeClient
Public Sub New (mexBinding As Binding)

Parameters

mexBinding
Binding

The binding to use when retrieving metadata using WS-Transfer.

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 this constructor to specify a binding to use when downloading metadata.

Applies to

MetadataExchangeClient(EndpointAddress)

Initializes a new instance of the MetadataExchangeClient class.

public:
 MetadataExchangeClient(System::ServiceModel::EndpointAddress ^ address);
public MetadataExchangeClient (System.ServiceModel.EndpointAddress address);
new System.ServiceModel.Description.MetadataExchangeClient : System.ServiceModel.EndpointAddress -> System.ServiceModel.Description.MetadataExchangeClient
Public Sub New (address As EndpointAddress)

Parameters

address
EndpointAddress

The metadata address.

Remarks

Use this constructor to specify the address of the metadata endpoint.

Applies to

MetadataExchangeClient(String)

Initializes a new instance of the MetadataExchangeClient class.

public:
 MetadataExchangeClient(System::String ^ endpointConfigurationName);
public MetadataExchangeClient (string endpointConfigurationName);
new System.ServiceModel.Description.MetadataExchangeClient : string -> System.ServiceModel.Description.MetadataExchangeClient
Public Sub New (endpointConfigurationName As String)

Parameters

endpointConfigurationName
String

The name of the endpoint configuration information to use when downloading metadata.

Remarks

Use this constructor to use the data from a specific endpoint configuration element to create a channel to download the metadata.

Applies to

MetadataExchangeClient(Uri, MetadataExchangeClientMode)

Initializes a new instance of the MetadataExchangeClient class.

public:
 MetadataExchangeClient(Uri ^ address, System::ServiceModel::Description::MetadataExchangeClientMode mode);
public MetadataExchangeClient (Uri address, System.ServiceModel.Description.MetadataExchangeClientMode mode);
new System.ServiceModel.Description.MetadataExchangeClient : Uri * System.ServiceModel.Description.MetadataExchangeClientMode -> System.ServiceModel.Description.MetadataExchangeClient
Public Sub New (address As Uri, mode As MetadataExchangeClientMode)

Parameters

address
Uri

The address of the metadata.

mode
MetadataExchangeClientMode

The mode to use when downloading the metadata.

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 this constructor to specify the address and whether to use an HTTP GET request or WS-Transfer Get. For more information, see System.ServiceModel.Description.MetadataExchangeClientMode.

Applies to