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.
source share