I have an Interface compiled into a .dll, referenced in a VS.NET 2003
Web Service project. The default .asmx implements the Interface. All
of the Interface-defined methods return strings.
I have a WinForms client that also includes the Interface .dll in it's
compiler references.
I want to use the WinForms client to create a new instance of "foo"
that implements the Interface and dynamically cast foo to the web
service. Just to make things easy, I would like to at runtime specify
the URI of the web service so it can be put in a config file.
How can I do that?
Thanks.
Gabriel Lacatus - 03 Apr 2006 16:12 GMT
To be able to talk with the webservice you'll need a proxy class. Of course
if all of your services implement the same interface, creating web
references using vs will result in "similar" proxy classes. Of course what
you want is not to create all these proxies from the beginning but instead
to be able to dinamically switch between services without creating a proxy
for it inthe first place.
What you have to do is manually create some sort of universal proxy, by
sneak-peaking at what VS is generating for one of your services. If all is
done right this universal proxy should be able to "talk" with any of your
services. At runtime you'll just have to make one instance of this proxy,
set its url to the desired webservice and start calling remote functions.
HTH
> I have an Interface compiled into a .dll, referenced in a VS.NET 2003
> Web Service project. The default .asmx implements the Interface. All
[quoted text clipped - 11 lines]
>
> Thanks.