Web References in code

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

Hi

I've only started "playing" with web services this weekend. I have one
question which I can't seem to find an solution to...

Is there a way to change the (web) server's name on which your web service
is running programatically? Let say I develop the web service on my
localhost but then I want to deploy it on a company's intranet - the server
hosting the web service will change. How can I during runtime enter the name
of the server hosting the webservice and then use/connect to it?

I hope I'm making sense. Any help would be great.

Francois
 
Look at the URL property of the proxy that your web reference created for you. Just change it to whatever is the correct server name when you deploy to production, or even better read it off a config file.

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
 
Sorry but, huh? Where do I find the "URL property of the proxy that your web
reference created"? In the WinApplication somewhere right? I looked through
the code generated by VB it doesn't seem to be there...

I apoligise for asking a seemingly stupid question...

Francois


Anand said:
Look at the URL property of the proxy that your web reference created for
you. Just change it to whatever is the correct server name when you deploy
to production, or even better read it off a config file.
 
When you refernce a webservice, a proxy is created for you by VS.NET. When you say dim a as webservice, you are referencing that proxy. Just look for the URL property in a.

Rgds,
Anand
VB.NET MVP
http://www.dotnetindia.com
 
Got it. thanks!

Anand said:
When you refernce a webservice, a proxy is created for you by VS.NET. When
you say dim a as webservice, you are referencing that proxy. Just look for
the URL property in a.
 
Back
Top