tags:

views:

618

answers:

3

Has anybody got any kind of experience with dynamic programming using WCF. By dynamic programming I mean runtime consumption of WSDL's. I have found one blog entry/tool: http://blogs.msdn.com/vipulmodi/archive/2006/11/16/dynamic-programming-with-wcf.aspx

Has anybody here found good tools for this?

+1  A: 

I have done this a long time ago with SOAP web services. There was a tool on GotDotNet which I think has become Web Services Studio Express, that had code which inspected/parsed a WSDL file and allowed you to call it.

I think the assumption is that the WSDL is known at the time of client creation, and you don't need to be hooked up at runtime. If you inspect the WSDL at runtime you still need to have some sort of logic to decide how to generate the proxy. Why would can you not consume the WSDL before runtime? Web Services are supposed to be fairly static with an interface that doesn't change once published.

You can use .NET CodeDom to generate code to execute and use the web service described by the WSDL. The WSDL can be parsed using the standard .NET XML classes.

BrianLy
Becouse the web service is being used to intergrade in with a 3rd party data feed, that the customer wishes to be able to setup without having to wait for the next release of the software. E.g Excel can inport data from a web service without Microsoft kowning about the WSDL when they wrote Excel!
Ian Ringrose
A: 

I am actually considering making a small ESB, where a user can add a webservice to route to at run time. So I can not add WSDLs statically

khebbie
+2  A: 

This is one of the weirder aspects of WCF. You can dynamically create a channelfactory, but only with a known type.

I came up with a solution that is not perfect, but does work:

Create an interface, "IFoo" which contains a single method, say Execute(). In your ESB, dynamically create a ChannelFactory<IFoo> for the endpoint that you want to connect to. Set the connection properties (URI, etc.).

Now, you can attach services dynamically to your ESB, provided that they always implement the "IFoo" interface.

Cuyler