Re: How to query n web services
- From: "Laurent Bugnion, MVP" <galasoft-lb@xxxxxxxxxx>
- Date: Mon, 10 Sep 2007 12:55:58 +0200
Hi,
Nightfall wrote:
Dear friends,
let's say we have 10 "server-side" web service which return some kind
of data.
I'm using visual studio 2005 and I have a Project - the client -
where I added Web References to those 10 ws.
When I added web references, I wrote 10 different web references name.
So, i.e., I should write
Name01.Service service01 = new Name01.Service();
Name02.Service service02 = new Name02.Service();
Name03.Service service03 = new Name03.Service();
...
and then invoke service01.someMethod...
But let's say that I just have to query a subset of those 10 ws.
The subset is given by strings. (so that I have to invoke only those
ws whose names are specified in the following strings)
string s1 = "Name01";
string s4 = "Name04";
string s7 = "Name07";
I need some way to do
Name01.Service service01 = new Name01.Service();
Name04.Service service04 = new Name04.Service();
Name07.Service service07 = new Name07.Service();
which, certainly is not
s1.Service service01 = new s1.Service();
isn't it?
Thanx a lot for any hint.
bye!
Using Reflection, you can use a string to create an instance of an object and then invoke methods on that instance. Check Reflection on Google.
Note that Reflection is slow, so don't use it for performance-critical operations.
HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft.ch
PhotoAlbum: http://www.galasoft.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
.
- Follow-Ups:
- Re: How to query n web services
- From: nano2k
- Re: How to query n web services
- References:
- How to query n web services
- From: Nightfall
- How to query n web services
- Prev by Date: How to query n web services
- Next by Date: web service question : server was unable to process request
- Previous by thread: How to query n web services
- Next by thread: Re: How to query n web services
- Index(es):
Relevant Pages
|