By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,147 Members | 744 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,147 IT Pros & Developers. It's quick & easy.

Setting web service location dynamically

P: n/a
Hi,

I have a production, test and development environment for my web application
and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g. Web.config? I
don't want to recompile the web application every time I move it to another
environment, nor do I want the code to be much more complicated than with a
hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service specified
by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund
Nov 19 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
> Is it possible to let the web services location be set in e.g. Web.config?

The location is simply wherever you copy it to...
I
don't want to recompile the web application every time I move it to another environment,


Why do you think you would have to?

-Jimmy
Nov 19 '05 #2

P: n/a
In visual studio change the property 'URL Behavior' of the web service
reference from 'static' to 'dynamic' this will automatically add an entry to
your web config for you
--
HTH

Ollie Riches
http://www.phoneanalyser.net

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a programmer
helping programmers.

"Nils Magnus Englund" <ni*****************@orkfin.no> wrote in message
news:u1**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a production, test and development environment for my web application and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g. Web.config? I don't want to recompile the web application every time I move it to another environment, nor do I want the code to be much more complicated than with a hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service specified by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund

Nov 19 '05 #3

P: n/a
Something along the lines of:

dim ws as new myWebService

ws.url = "http://999.999.999.999/My_Web_Service/Service1.asmx"

You could store the IP address in the web.config and just read it in before
setting the ws.url.

Hope this helps
Chris.

"Nils Magnus Englund" wrote:
Hi,

I have a production, test and development environment for my web application
and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g. Web.config? I
don't want to recompile the web application every time I move it to another
environment, nor do I want the code to be much more complicated than with a
hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service specified
by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund

Nov 19 '05 #4

P: n/a
Hi Jimmy,

Thank you for your reply, but I'm afraid you misunderstood - although I can
place the web service wherever I want to, I need to somehow be able to refer
the web application to the web service. How can I tell the web application
the location of the web service? One method is by hardcoding it into the
solution, but I wanted to do it dynamically, so I didn't have to recompile
the solution when changing the web services hardcoded location.
Regards,
Nils Magnus Englund

"Jimmy Tharpe" <ji**********@aps-soft.com> wrote in message
news:uQ**************@tk2msftngp13.phx.gbl...
Is it possible to let the web services location be set in e.g.
Web.config?


The location is simply wherever you copy it to...
I
don't want to recompile the web application every time I move it to

another
environment,


Why do you think you would have to?

-Jimmy

Nov 19 '05 #5

P: n/a
Hi Chris, and thanks for your reply.

I think I indeed could do that, but that wouldn't let Visual Studio
automatically make the classes and return types I need to fetch data from
the web methods. It would however work great if I only used basic .NET types
for the web application <> web service communication.
Regards,
Nils Magnus Englund
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
Something along the lines of:

dim ws as new myWebService

ws.url = "http://999.999.999.999/My_Web_Service/Service1.asmx"

You could store the IP address in the web.config and just read it in
before
setting the ws.url.

Hope this helps
Chris.

"Nils Magnus Englund" wrote:
Hi,

I have a production, test and development environment for my web
application
and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g.
Web.config? I
don't want to recompile the web application every time I move it to
another
environment, nor do I want the code to be much more complicated than with
a
hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service
specified
by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund

Nov 19 '05 #6

P: n/a
Hi Ollie,

Thank you! I feel slightly embarassed for not figuring that out by myself ;)
That was exactly the kind of functionality I was looking (and hoping) for.
Regards,
Nils Magnus Englund
"Ollie Riches" <ol**********@phoneanalser.net> wrote in message
news:eu*************@TK2MSFTNGP15.phx.gbl...
In visual studio change the property 'URL Behavior' of the web service
reference from 'static' to 'dynamic' this will automatically add an entry
to
your web config for you
--
HTH

Ollie Riches
http://www.phoneanalyser.net

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a programmer
helping programmers.

"Nils Magnus Englund" <ni*****************@orkfin.no> wrote in message
news:u1**************@TK2MSFTNGP09.phx.gbl...
Hi,

I have a production, test and development environment for my web

application
and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g.
Web.config?

I
don't want to recompile the web application every time I move it to

another
environment, nor do I want the code to be much more complicated than with

a
hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service

specified
by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund


Nov 19 '05 #7

P: n/a
I don't understand what you mean that it would work great only if you used
basic .NET types. Changing the URL doesn't affect what the web service can
return. All it's doing is changing the location of the web service which is
what I thought you wanted to do. Did I miss something?

Chris.

"Nils Magnus Englund" wrote:
Hi Chris, and thanks for your reply.

I think I indeed could do that, but that wouldn't let Visual Studio
automatically make the classes and return types I need to fetch data from
the web methods. It would however work great if I only used basic .NET types
for the web application <> web service communication.
Regards,
Nils Magnus Englund
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
Something along the lines of:

dim ws as new myWebService

ws.url = "http://999.999.999.999/My_Web_Service/Service1.asmx"

You could store the IP address in the web.config and just read it in
before
setting the ws.url.

Hope this helps
Chris.

"Nils Magnus Englund" wrote:
Hi,

I have a production, test and development environment for my web
application
and a web service (The test web application connects to the test web
service, and so on).

Is it possible to let the web services location be set in e.g.
Web.config? I
don't want to recompile the web application every time I move it to
another
environment, nor do I want the code to be much more complicated than with
a
hardcoded location. The web service methods and classes are identical for
all three environments, so I could let VS.NET talk to the development web
service for figuring out class definitions etc. (I just want the actual
communication when the web app is in use to be to the web service
specified
by each environment).

Hope I made it clear to you what I'm trying to figure out :)

Thanks!
Regards,
Nils Magnus Englund


Nov 19 '05 #8

P: n/a
Hi Chris,

No, sorry, I missed something :) I thought you meant instantiating a basic
web service, not my own web service (missed the crucial _my_WebService
definition). Your method would work great as well! Thanks a lot :)
Regards,
Nils Magnus Englund
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
I don't understand what you mean that it would work great only if you used
basic .NET types. Changing the URL doesn't affect what the web service can
return. All it's doing is changing the location of the web service which
is
what I thought you wanted to do. Did I miss something?

Chris.

"Nils Magnus Englund" wrote:
Hi Chris, and thanks for your reply.

I think I indeed could do that, but that wouldn't let Visual Studio
automatically make the classes and return types I need to fetch data from
the web methods. It would however work great if I only used basic .NET
types
for the web application <> web service communication.
Regards,
Nils Magnus Englund
"Chris Podmore" <Ch**********@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...
> Something along the lines of:
>
> dim ws as new myWebService
>
> ws.url = "http://999.999.999.999/My_Web_Service/Service1.asmx"
>
> You could store the IP address in the web.config and just read it in
> before
> setting the ws.url.
>
> Hope this helps
> Chris.
>
> "Nils Magnus Englund" wrote:
>
>> Hi,
>>
>> I have a production, test and development environment for my web
>> application
>> and a web service (The test web application connects to the test web
>> service, and so on).
>>
>> Is it possible to let the web services location be set in e.g.
>> Web.config? I
>> don't want to recompile the web application every time I move it to
>> another
>> environment, nor do I want the code to be much more complicated than
>> with
>> a
>> hardcoded location. The web service methods and classes are identical
>> for
>> all three environments, so I could let VS.NET talk to the development
>> web
>> service for figuring out class definitions etc. (I just want the
>> actual
>> communication when the web app is in use to be to the web service
>> specified
>> by each environment).
>>
>> Hope I made it clear to you what I'm trying to figure out :)
>>
>> Thanks!
>>
>>
>> Regards,
>> Nils Magnus Englund
>>
>>
>>


Nov 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.