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

Dynamic WebReference URL

P: n/a
Hi.

Using VStudio I have developed a WebService which I placed onto several
servers. However my application can only access one on server.

During runtime, I tried to change the URL of the webreference to the other
server but that does not work -- the webreference still thinks it is the old
one and errors out.

I need to be able to dynamically switch from one server to the other, but
have the same service on both servers. It seems that VS webreferences do
not allow this.

Any insight into this problem is much appreciated.

I hope I was clear enough in describing it.

Thanks,

Kimba
Feb 20 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Set the URL property to Dynamic and the generated proxy code will retrieve
the value from the application config file (check the proxy code to see
under hwihc key it should be stored).

Else you can also change programmaticaly the url property (perhaps write
down this just before calling the service in case you mistakenly changed
this not at the right location, especially if you create the service several
times).

--
Patrice

"Kimba" <ki***@nospam.nospam> a écrit dans le message de
news:uS**************@TK2MSFTNGP11.phx.gbl...
Hi.

Using VStudio I have developed a WebService which I placed onto several
servers. However my application can only access one on server.

During runtime, I tried to change the URL of the webreference to the other
server but that does not work -- the webreference still thinks it is the old one and errors out.

I need to be able to dynamically switch from one server to the other, but
have the same service on both servers. It seems that VS webreferences do
not allow this.

Any insight into this problem is much appreciated.

I hope I was clear enough in describing it.

Thanks,

Kimba

Feb 20 '06 #2

P: n/a
Your suggestion works if I change them and then recompile my application.

But I need to do this while the application is running.

With SOAP 3.0 you could specify the WSDL (file, string, or url) during
initialization. Then you could reference the WebServices. My code use to
work with SOAP 3.0. I need the same functionality.
When I change the URL in my basic code (where sURL refers to the desired
Server not the "compiled" server name):
My.Settings.WebSignServicesURL = sURL

svcWebSign = New WebSignConsole.WebSignServer.Service

svcWebSign.Credentials = cc

svcWebSign.Url = sURL

The WSDL does not seem to change and the old server is still referenced.
Then I get the following exception:

"System.Web.Services.Protocols.SoapException: Server did not recognize the
value of HTTP Header SOAPAction: https://wst0002/WebSignServices/UserVerify.

at System.Web.Services.Protocols.Soap11ServerProtocol Helper.RouteRequest()

at
System.Web.Services.Protocols.SoapServerProtocol.R outeRequest(SoapServerMessage
message)

at System.Web.Services.Protocols.SoapServerProtocol.I nitialize()

at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)"



"Patrice" <a@bc.c> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Set the URL property to Dynamic and the generated proxy code will retrieve
the value from the application config file (check the proxy code to see
under hwihc key it should be stored).

Else you can also change programmaticaly the url property (perhaps write
down this just before calling the service in case you mistakenly changed
this not at the right location, especially if you create the service
several
times).

--
Patrice

"Kimba" <ki***@nospam.nospam> a écrit dans le message de
news:uS**************@TK2MSFTNGP11.phx.gbl...
Hi.

Using VStudio I have developed a WebService which I placed onto several
servers. However my application can only access one on server.

During runtime, I tried to change the URL of the webreference to the
other
server but that does not work -- the webreference still thinks it is the

old
one and errors out.

I need to be able to dynamically switch from one server to the other, but
have the same service on both servers. It seems that VS webreferences do
not allow this.

Any insight into this problem is much appreciated.

I hope I was clear enough in describing it.

Thanks,

Kimba


Feb 20 '06 #3

P: n/a
Hi Kimba,

Normally, if the webservice on different servers are exactly the same ones,
we can just use the single webservice client proxy by programmatically
change its Url property at runtime(or change the config file). However,
there are something which may prevent the generated client proxy from
sharing accross multiple webservices on different server. In your case, the
error message indicate that the SOAP Action http header is not recognized
by the server, is the below soap header the one works on your another
server but different from the current server where you get error?

"https://wst0002/WebSignServices/UserVerif"

Or in other words, is the webservice on current server apply a different
namespace from the original server's webservice code?

If this is the case, we do need to regenerate webservice proxy since SOAP
Action header is compiled into the proxy code from the service(WSDL)'s
namespace...

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.)
Feb 21 '06 #4

P: n/a
My suggestion is not about recompiling. It's just to tell that it should
work either :
- by letting the proxy read the web service location from the application
config file (the service has a property to include the appropriate code)
- by changing yourself this property at runtime based on whatever you want
(for exemple the location of the code)

Here it looks like to me that you have a problem in talking to a different
webservice. Are you sure that both services are exactly the same or could
you have different versions on those two servers ?

Also I don't see why you would expect the WSDL to change ? The WSDL is
create server side and having the client connect to a service doesn't change
the WSDL description ?

I'm strating to wxonder if you try to connect to services that are *not* the
same on those twoservers ?

It works fine here...

--
Patrice

"Kimba" <ki***@nospam.nospam> a écrit dans le message de
news:OC**************@TK2MSFTNGP14.phx.gbl...
Your suggestion works if I change them and then recompile my application.

But I need to do this while the application is running.

With SOAP 3.0 you could specify the WSDL (file, string, or url) during
initialization. Then you could reference the WebServices. My code use to
work with SOAP 3.0. I need the same functionality.
When I change the URL in my basic code (where sURL refers to the desired
Server not the "compiled" server name):
My.Settings.WebSignServicesURL = sURL

svcWebSign = New WebSignConsole.WebSignServer.Service

svcWebSign.Credentials = cc

svcWebSign.Url = sURL

The WSDL does not seem to change and the old server is still referenced.
Then I get the following exception:

"System.Web.Services.Protocols.SoapException: Server did not recognize the
value of HTTP Header SOAPAction: https://wst0002/WebSignServices/UserVerify.
at System.Web.Services.Protocols.Soap11ServerProtocol Helper.RouteRequest()

at
System.Web.Services.Protocols.SoapServerProtocol.R outeRequest(SoapServerMess
age message)

at System.Web.Services.Protocols.SoapServerProtocol.I nitialize()

at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)"



"Patrice" <a@bc.c> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
Set the URL property to Dynamic and the generated proxy code will retrieve the value from the application config file (check the proxy code to see
under hwihc key it should be stored).

Else you can also change programmaticaly the url property (perhaps write
down this just before calling the service in case you mistakenly changed
this not at the right location, especially if you create the service
several
times).

--
Patrice

"Kimba" <ki***@nospam.nospam> a écrit dans le message de
news:uS**************@TK2MSFTNGP11.phx.gbl...
Hi.

Using VStudio I have developed a WebService which I placed onto several
servers. However my application can only access one on server.

During runtime, I tried to change the URL of the webreference to the
other
server but that does not work -- the webreference still thinks it is the
old
one and errors out.

I need to be able to dynamically switch from one server to the other,

but have the same service on both servers. It seems that VS webreferences do not allow this.

Any insight into this problem is much appreciated.

I hope I was clear enough in describing it.

Thanks,

Kimba



Feb 21 '06 #5

P: n/a
Case Closed.

Thanks so much for your persistent help.

You were correct in all aspects.

The WebService namespace was different on each server's .ASMX -- my bad.

Now my application users can "login" to any server and expect (and get) the
same web services.

I have to really compliment the VStudio team on their latest version.

I have been porting: GUI, SQL Server database, WinHTTP, and SOAP code from
the VStudio 6.0 to VStudio 2005.

There are so many great improvements -- I am really quite astounded and
pleased.



"Patrice" <a@bc.c> wrote in message
news:uo*************@TK2MSFTNGP15.phx.gbl...
My suggestion is not about recompiling. It's just to tell that it should
work either :
- by letting the proxy read the web service location from the application
config file (the service has a property to include the appropriate code)
- by changing yourself this property at runtime based on whatever you want
(for exemple the location of the code)

Here it looks like to me that you have a problem in talking to a different
webservice. Are you sure that both services are exactly the same or could
you have different versions on those two servers ?

Also I don't see why you would expect the WSDL to change ? The WSDL is
create server side and having the client connect to a service doesn't
change
the WSDL description ?

I'm strating to wxonder if you try to connect to services that are *not*
the
same on those twoservers ?

It works fine here...

--
Patrice

"Kimba" <ki***@nospam.nospam> a écrit dans le message de
news:OC**************@TK2MSFTNGP14.phx.gbl...
Your suggestion works if I change them and then recompile my application.

But I need to do this while the application is running.

With SOAP 3.0 you could specify the WSDL (file, string, or url) during
initialization. Then you could reference the WebServices. My code use
to
work with SOAP 3.0. I need the same functionality.
When I change the URL in my basic code (where sURL refers to the desired
Server not the "compiled" server name):
My.Settings.WebSignServicesURL = sURL

svcWebSign = New WebSignConsole.WebSignServer.Service

svcWebSign.Credentials = cc

svcWebSign.Url = sURL

The WSDL does not seem to change and the old server is still referenced.
Then I get the following exception:

"System.Web.Services.Protocols.SoapException: Server did not recognize
the
value of HTTP Header SOAPAction:

https://wst0002/WebSignServices/UserVerify.

at
System.Web.Services.Protocols.Soap11ServerProtocol Helper.RouteRequest()

at

System.Web.Services.Protocols.SoapServerProtocol.R outeRequest(SoapServerMess
age
message)

at System.Web.Services.Protocols.SoapServerProtocol.I nitialize()

at System.Web.Services.Protocols.ServerProtocolFactor y.Create(Type type,
HttpContext context, HttpRequest request, HttpResponse response, Boolean&
abortProcessing)"



"Patrice" <a@bc.c> wrote in message
news:um**************@TK2MSFTNGP11.phx.gbl...
> Set the URL property to Dynamic and the generated proxy code will retrieve > the value from the application config file (check the proxy code to see
> under hwihc key it should be stored).
>
> Else you can also change programmaticaly the url property (perhaps
> write
> down this just before calling the service in case you mistakenly
> changed
> this not at the right location, especially if you create the service
> several
> times).
>
> --
> Patrice
>
> "Kimba" <ki***@nospam.nospam> a écrit dans le message de
> news:uS**************@TK2MSFTNGP11.phx.gbl...
>> Hi.
>>
>> Using VStudio I have developed a WebService which I placed onto
>> several
>> servers. However my application can only access one on server.
>>
>> During runtime, I tried to change the URL of the webreference to the
>> other
>> server but that does not work -- the webreference still thinks it is the > old
>> one and errors out.
>>
>> I need to be able to dynamically switch from one server to the other, but >> have the same service on both servers. It seems that VS webreferences do >> not allow this.
>>
>> Any insight into this problem is much appreciated.
>>
>> I hope I was clear enough in describing it.
>>
>> Thanks,
>>
>> Kimba
>>
>>
>
>



Feb 21 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.