views:

40

answers:

1

hi I am new in .net technology.

I have some knowledge about webservices and how to add webrefferences in the project. In my project there is a same web servises will run on more than two server. All web services are same just their servers are diffenrent.

So is there a way to add web services dynamically? and i can call web services from the server which user specify if there is no web services available then it will return false.

in sort i need to call server dynamically as user specify server name thanks for help

+3  A: 

Use web service proxy's Url property to set the new url dynamically. Store URL of the web service in your application's parameter table / config file. At runtime always get the web service's Url from that parameter and set it to your web service's Url as destination.

Ok, I'll give an example how to use it. For example let's say we have to add this web service to your project :

http://server1/service1/service.asmx

And then we specify MyService as proxy name to your web service. Then while we use this web service set the Url property like that to specify your proxy's destination :

MyService myService = new MyService();
myService.Url = "http://server2/service1/service.asmx";
myService.GetOrders(customerNo);
Canavar
thanks Canavarwill please explain more about it.if posible please give some example code.because i try to find such thing but didn't get the answer thanks
jazzy