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";
精彩评论