Dynamic Programming with WCF

Does anyone have any experience with dynamic programming using WCF. In dynamic programming, I mean consuming WSDL at runtime. I found one blog entry / tool: http://blogs.msdn.com/vipulmodi/archive/2006/11/16/dynamic-programming-with-wcf.aspx

Has anyone here found good tools for this?

+4
source share
3 answers

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

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

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

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

+2
source

I did this a long time ago using SOAP web services. There was a GotDotNet tool, which I think became Web Services Studio Express , which had code that checked / parsed the WSDL file and let you name it.

I think it is assumed that WSDL is known at client creation time and you do not need to connect at runtime. If you check WSDL at runtime, you still need to have some kind of logic to decide how to create a proxy server. Why don't you use WSDL before launch? Web services are supposed to be fairly static with an interface that does not change after publication.

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

+2
source

I am really considering creating a small ESB where a user can add a web service for routing at runtime. Therefore, I cannot add WSDLs statically

0
source

Source: https://habr.com/ru/post/1276526/


All Articles