Dynamically Calling Interface and Class in WCF Service
I have hosted my WCF service as net.tcp://ASSS-dd1-092:5001/WCFTestService** Is it possible on Client I will get my Class name and I开发者_Go百科nterface name along with method name without Adding Service As a ServiceReference in my Project reference.
In other words we can get generic in nature
Yes, if you expose metadata endpoint you can consume metadata by your client and build correct message according to the metadata but it is very very complex. Your generic solution means that you will not work with class or interface but you will manually build XML message according to exposed description any you will manually define client endpoint according to the description.
But do you really need it? How can you consume generic service if you don't know what data you have to pass and receive and what methods you want to call? I believe you know this and because of that you can add service contract and data contracts to your client - once you do that you can use ChannelFactory
to call the service. If you don't know configuration (binding) of the service you can use metadata resolver and if you don't know the address (and perhaps also binding) of the service but you know that it is on your network you can use WCF Discovery.
精彩评论