如何使用现有的 wsdl 动态调用 WCF 服务?

问题描述:

有人知道如何使用现有的 wsdl 文件动态调用 WCF 服务吗?因此,我不需要使用添加服务引用...".一切都应该动态完成.

Does anybody know how to dynamically invoke WCF service using existing wsdl file? Thus, I don't need to use "Add Service Reference...". Everything should be done dynamically.

我在互联网上搜索过,但没有找到与以下内容类似的内容:

I've searched the internet and haven't found anything that is similar to:

EndpointAddress address = new EndpointAddress("http://localhost:3929/Service1.svc?wsdl");

EndpointAddress address = new EndpointAddress("http://localhost:3929/Service1.svc?wsdl");

我使用 VS2008 (.NET 3.5).

I use VS2008 (.NET 3.5).

提前致谢.

戈兰

如果您查看 Channel Factory 这应该是您所需要的.

If you take a look at the Channel Factory this should be what you need.