Showing posts with label contained. Show all posts
Showing posts with label contained. Show all posts

Monday, March 26, 2012

Web service address is changed

Hi,
I had a web server contained a web service.
We had to change the web server computer; so all client proxies must point
to new web server. My understanding is we have to compile all client
applications again.
We will probably change the address of web server in future again.
Is there any way that client applications programatically change the address
of web service in the proxy? I am thinking to have the address in
app.config, so we don't have to compile all client application any time that
we change the address of web server.
Thanks,
AlanHi Alan:
In the Solution Explorer window, highlight the reference to the web
service under the Web References node, then view the properties.
Change the URL Behavior property from Static to Dynamic.
The web service proxy will now read the URL from web.config. Looking
in web.config you should see the IDE made an entry looking like:
<add key="WebApp.localhost.Service1"
value=http://server/WebService/Service1.asmx
/>
Now you can change the endpoint without a recompile.
HTH,
Scott
http://www.OdeToCode.com/blogs/scott/
On Mon, 8 Nov 2004 23:46:18 -0500, "A.M" <nospam1@.online.nospam>
wrote:

>Hi,
>
>I had a web server contained a web service.
>We had to change the web server computer; so all client proxies must point
>to new web server. My understanding is we have to compile all client
>applications again.
>We will probably change the address of web server in future again.
>
>Is there any way that client applications programatically change the addres
s
>of web service in the proxy? I am thinking to have the address in
>app.config, so we don't have to compile all client application any time tha
t
>we change the address of web server.
>
>Thanks,
>Alan
>
>
Thanks for Scott's suggestion.
Hi Alan,
As Scott has mentioned, we can dynamically change the webservice's client
proxy class's target url(asmx file's url). We can dig into the client proxy
class(WSDL.EXE generate for us)'s code, you'll find the class is something
like:
public class MyService :
System.Web.Services.Protocols.SoapHttpClientProtocol {
/// <remarks/>
public MyService() {
this.Url = "http://sha-schang-01/myservice/myservice.asmx";
}
.....
And the "Url" property is just the one we need to update when the
webservice's deployment server changed.
Thanks.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Web service address is changed

Hi,

I had a web server contained a web service.

We had to change the web server computer; so all client proxies must point
to new web server. My understanding is we have to compile all client
applications again.

We will probably change the address of web server in future again.

Is there any way that client applications programatically change the address
of web service in the proxy? I am thinking to have the address in
app.config, so we don't have to compile all client application any time that
we change the address of web server.

Thanks,

AlanHi Alan:

In the Solution Explorer window, highlight the reference to the web
service under the Web References node, then view the properties.
Change the URL Behavior property from Static to Dynamic.

The web service proxy will now read the URL from web.config. Looking
in web.config you should see the IDE made an entry looking like:

<add key="WebApp.localhost.Service1"
value=http://server/WebService/Service1.asmx
/
Now you can change the endpoint without a recompile.

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 8 Nov 2004 23:46:18 -0500, "A.M" <nospam1@.online.nospam>
wrote:

>Hi,
>
>I had a web server contained a web service.
>We had to change the web server computer; so all client proxies must point
>to new web server. My understanding is we have to compile all client
>applications again.
>We will probably change the address of web server in future again.
>
>Is there any way that client applications programatically change the address
>of web service in the proxy? I am thinking to have the address in
>app.config, so we don't have to compile all client application any time that
>we change the address of web server.
>
>Thanks,
>Alan
Thanks for Scott's suggestion.

Hi Alan,

As Scott has mentioned, we can dynamically change the webservice's client
proxy class's target url(asmx file's url). We can dig into the client proxy
class(WSDL.EXE generate for us)'s code, you'll find the class is something
like:

public class MyService :
System.Web.Services.Protocols.SoapHttpClientProtoc ol {

/// <remarks/>
public MyService() {
this.Url = "http://sha-schang-01/myservice/myservice.asmx";
}
......

And the "Url" property is just the one we need to update when the
webservice's deployment server changed.

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)