views:

25

answers:

2

Hi,

Could anyone out there give some pointers on how to go about getting a listing of all the web service references used by a WCF application - the pseudo code I'm envisioning might look something like:

For each ws in MyWebServices Console.WriteLine("Service Name: " & ws.Name) Next

How to build the MyWebServices object is what I am wondering?

Thanks

+1  A: 

You could just check the configuration file. All WCF services used by the application should be in the client section.

Shiraz Bhaiji
+2  A: 

You should be able to do:

ClientSection clientSection = (ClientSection)ConfigurationManager.GetSection("system.serviceModel/client");

foreach(ChannelEndpointElement channelEndpointElement in clientSection.Endpoints)
{
    // Use any of the channel endpoint element properties here:
    // Address, BehaviorConfiguration, Binding, BindingConfiguration, Contract, etc.
}
Drew Marsh
Kind of a forehead slapper once I saw the answer. Seems so obvious now. Thanks for the help!Both this answer and the answer below are correct but marking this one as 'answer' for completeness
Gatmando