Retrieving of ContractDescription

Damir Dobric Posts

Next talks:



Follow me on Twitter: #ddobric




Resolving of metadata of one service is required in many situations when the data has to be explored dynamically. Unfortunately this is often not always a trivial task. Most examples describe briefly how to retrieve the metadata (ServiceDescription) from the running service. However, sometimes it is required to obtain the description from the type. This is the case when the service is possible not running or not reachable. Following example show how to do that.

Imagine there is a contract described with following interface:

public interface ITestInterface
void operation1(); 
string operation2(int i);

The idea behind this example is to obtain the contract description in the way shown below:

ContractDescription desc =

In this case the implementation of the magic function would be:

public static ContractDescription ExportServiceContract(string contract)
Type dynamicFactoryType =

ChannelFactory dynamicFactoryInstance =

      null, null, null) as ChannelFactory

return dynamicFactoryInstance.Endpoint.Contract;

Posted Oct 01 2007, 06:15 PM by Damir Dobric
Filed under:


Damir Dobric Posts wrote Creating WSDL from nothing
on 01-03-2008 23:44

In one SOA project, we have requirement to create the WSDL (Service Description) long before the service is a .Net Community Blog powered by daenet GmbH.