是否可以在运行时更改 WebReference 的属性?

发布于 2024-07-07 02:42:43 字数 151 浏览 6 评论 0原文

我正在尝试提出这样一个解决方案:用户将输入 Web 服务的 URL,然后对其进行测试。

虽然我想要的是 URL 更改,但我保证服务描述始终是相同的(当然,包含soap:address 的 wsdl:service 标记除外); 我只是想测试运行相同服务的不同客户。

I am trying to come up with such a solution that the user is going to enter the URL of a web-service and it is going to be tested.

Although what I want is a URL change, I guarantee the Service Description is always going to be the same (except the wsdl:service tag of course which contains the soap:address); I just want to test different customers, running the same service.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无人接听 2024-07-14 02:42:44

是的你可以。 只需在调用服务代理上的任何方法之前更改服务代理的 url 属性即可。

yes you can. just change the url property of the service proxy before calling any methods on it.

贵在坚持 2024-07-14 02:42:44

是的; 每个网络服务代理都提供了一种方法来做到这一点; 对于 WCF 之前的代理(包括 WSEx),地址是代理类上的 Url 属性 - 只需在对代理执行任何有趣的操作之前更改它即可。

对于 WCF,我相信您可以通过构造函数之一指定端点地址。

因此,只需从参考 wsdl 生成代理,然后就可以了;-p

Yes; every web-service proxy offers a way to do this; with pre-WCF proxies (including WSEx) the address is the Url property on the proxy class - just change it before you do anything interesting with the proxy.

With WCF, I believe you specify the endpoint-address via one of the constructors.

So just generate your proxy from your reference wsdl, and off you go ;-p

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文