Home > Uncategorized > WCF # 15 – WCF Service Behaviour Introduction (Exporting and Publishing Metadata)[Part II]

WCF # 15 – WCF Service Behaviour Introduction (Exporting and Publishing Metadata)[Part II]

Hi Friends,

In our last post Service Behaviour [Part – I] we learned how Concurrency and Instancing are important in improving the performance of a WCF Service.

In this article we will go through the MetaData Service Behavior.

The ABC’s of Endpoints – its addresses, bindings, and contracts—are represented in metadata so that potential clients know where, how, and what to communicate. This information is collectively referred to as service metadata.

Metadata is –

  1. The operations [WCF Methods] a service have.
  2. The structure of the data types that the methods take as input or return
  3. Definitions of all the Endpoints implemented by the service and the various options needed for each such as security

* Two steps are necessary to make metadata useful for clients:

1) Export it in a format that they can read and publish it somewhere that they can find it.
The default export format is WSDL, so as long as clients can read standardsbased
metadata format, they can understand how to communicate with the
service.

2) WCF publishes the metadata using the WS-MetadataExchange protocol over any supported transport, or it can publish the metadata in response to an HTTP GET. Both of these steps, the export and publishing the metadata, are implemented by the ServiceMetadataBehavior in a service.

* Metadata is exposed from a service through a Metadata Exchange (MEX) endpoint. A MEX endpoint is like any other WCF endpoint: It has an address, a binding, and a contract. Like any other endpoint, a MEX endpoint can be added to a service either through configuration or through code.

A MEX endpoint should expose the IMetadataExchange interface as its
contract.this interface provides methods that inspect a service and expose its metadata as WSDL.

A number of system-supplied bindings are available for MEX endpoints, such as mexHttpBinding,mexHttpsBindin,mexNamedPipeBinidng.

NOTE – By default WCF Services do not expose Metadata exchange endpoint.Without knowing the information like address,Binding and contract it is very difficult to communicate with the service.WCF makes it easy to expose a MEX endpoint so that clients can communicate properly with services. The MEX endpoint can be exposed in code or in configuration.

The Link Enable Metadata of a Web Service  will help you in exposing/enabling the METADATA EXCHANGE point for a service using code and configuration files.

Thank You.

Advertisements
Categories: Uncategorized
  1. inder
    May 25, 2012 at 3:20 am

    These are very good topics on WCF.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: