Hello Sebitti,
When u add web reference wsdl generate proxy, that added to you project.
Unfortunately, there is no clear way to change proxies in runtime, but you
can write a small
wrapper class, that will dynamically (by CodeDOM) include proxy u specify
in runtime
S> How can I use webservice without adding web reference to my winforms
S> application at design time. I need to be able to change server url at
S> runtime. What is the simplest way to achieve this? Also any vb code
S> samples would be appreciated.
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Johanna - Do you know the URL of the Web Service at Design time? If so
you have a couple of options.
1) Use the "Add Web Reference" tool in VS.NET and save off th
Reference.cs (Reference.vb) file that gets generated onto your projec
and then remove the web reference.
- When the Web Reference is created in your project go to th
"properties" of the Web Reference and set the "URL Behavior" t
"Dynamic". Now when you instantiate the Web Reference Namespace/class
you will have a property called "URL", you can set the URL through you
code.
2) Use the WSDL.exe tool to generate the Reference File, however th
WSDL tool is used when you do "Add Web Reference" anyway.
- Same as #1
If you don't know the URL of the web service at design time, but kno
it at Run Time, then you can use Reflection to gain access to the We
Service References.
Worst come to worst, if the Web Services allow for HTTP Post/Gets, the
you can create a HTTPRequest Object (using the QueryString to pass th
appropriate params) and then scrape the Response object for the info.
Hope this helps. If you need some example code, post back whic
scenario best fit you.
Ralp
--
rvira
Jon Frost - 03 Oct 2005 23:36 GMT
Hi Ralph,
I need to connect to a variety of web services at run-time. I need to
connect to the various web services throughout the day and I expect a lot of
traffic so I need to avoid memory leaks. I have about 20 different method
names. A code sample would be great.
Thanks,
Jon
"rviray" wrote in message news:...
> Johanna - Do you know the URL of the Web Service at Design time? If so,
> you have a couple of options.
[quoted text clipped - 7 lines]
>
> Ralph