开发者

In winforms, how do I dynamically change the url of my web reference?

开发者 https://www.devze.com 2023-01-14 23:43 出处:网络
I have 2 websites with an identical web service.For web service SampleService, I would like to know how to choose which web server to choose from.

I have 2 websites with an identical web service. For web service SampleService, I would like to know how to choose which web server to choose from.

  • Web service: "SampleService"
  • Web reference: "SampleWebReference"

Web service url:

  • Site 1: http://www.samplesite.com
  • Site 2: http://www2.samplesite.com

Q: How do I programmatically change which site the web reference reference开发者_如何学JAVAs based on user selection?


Click on your web service and in the properties window set the URL behaviour to Dynamic.

Then to set the url in code:

SampleWebReference reference = new SampleWebReference();
reference.Url = "http://www2.samplesite.com";
0

精彩评论

暂无评论...
验证码 换一张
取 消