Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / October 2005

Tip: Looking for answers? Try searching our database.

Web service client question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sebitti - 27 Sep 2005 13:01 GMT
How can I use webservice without adding web reference to my winforms
application at design time. I need to be able to change server url at
runtime. What is the simplest way to achieve this? Also any vb code samples
would be appreciated.

Thanks :-)
Johanna
Michael Nemtsev - 27 Sep 2005 14:12 GMT
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
rviray - 27 Sep 2005 14:33 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.