动态调用 WebService(精) 多数时候我们通过 "添加 Web 引用" 创建客户端代理类的方式调用WebService,但在某些情况下我们可能需要在程序运行期间动态调用一个未知的服务。在 .NET Framework 的 System.Web.Services.Description 命名空间中有我们需要的东西。具体步骤:1. 从目标 URL 下载 WSDL 数据。2. 使用 ServiceDescription 创建和格式化 WSDL 文档文件。3. 使用 ServiceDescriptionImporter 创建客户端代理类。4. 使用 CodeDom 动态创建客户端代理类程序集。5. 利用反射调用相关 WebService 方法。OK,看看具体的例子。我们要调用的目标 WebService,其 URL 是 http://localhost:60436/Learn.WEB/WebService.asmxHelloWorld.asmx [WebService(Namespace = "http://www.rainsts.net/", Description="我的Web服务")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 原文出处:http://www.cnblogs.com/illele/archive/2007/10/20/931317.html 相关文章: 2021-05-18 2021-06-14