Sorry but I don't understand why you need 10 References!!!
Maybe I misunderstood something, but you say it is the same Webservice.
Wich means for me, it has the same functions!
If it is like this - I have only the need for one reference!
Or let's better say I have the need for one "proxy".
And one time this WS runs on
http://mymachine1.dom.com/TheSvc/Svc.asmx
and the other time it runs on
http://othermachine2.otherdom.net/OtherPath/othername.asmx
If it is like this - there is no need for 10 refs!!
My approach will work in this case!!
We for an example have an application, where every customer owns it's own
database.
This DB is accessed via webservices. This WS can run on our server, or on an
extra
server for the customer.
In simple words - if the customer is small - his DB (and WS) will run on
one of our servers.
If the customer is big, he owns his web- an dbserver.
First of all - the application calls a central server, does authentication
and as a result it gets the
URL of the customers server. The next call goes to this server. Wich it is
will be figured out at
runtime - AND we have only one reference per WS we use!!
So ONE ref 20 and more servers!
Manfred
sendhil said:
hi Manfred,
Iam calling the same WebService 10 times. But they are in 10
different machines. so i will have 10 different Webreferences ..right.
so i can't just change the URL every time with one Webreference.
Thanks
sendhil
"Manni" <
[email protected]> wrote in message
Hi sendhil!
If understand you right you have 10 times the same webservice!
So first of all you can say - you have 1 webservice with 10 different URLs!?
If that is right - you just have to add one refference - and 9 "extra urls"
(or better 10 urls).
So make an array (of strings) with that 10 URLs.
Then call your WS with a 2 lines instead of 1 line
theSvcRef.Url=stringArr[numberYouChose];
theSvcRef.TheMethod();
or if you (why ever) have to call all of them and dont want two lines of
code do:
object [] arrSvcs=new object[10];
arrSvcs[0]=new TheSvcNS.SevName();
((TheSvcNS.SevName)arrSvc[0]).Url=strURL1;
arrSvcs[1]=new TheSvcNS.SevName();
((TheSvcNS.SevName)arrSvc[1]).Url=strURL2;
arrSvcs[2]=new TheSvcNS.SevName();
((TheSvcNS.SevName)arrSvc[3]).Url=strURL3;
and later call it (for an example in a lopp):
for(int nInd=0;nInd<10;nInd++) {
((TheSvcNS.SevName)arrSvc[0]).TheMethod();
}
HTH
Manfred