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 / February 2006

Tip: Looking for answers? Try searching our database.

Dynamic WebReference URL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kimba - 20 Feb 2006 14:11 GMT
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
Patrice - 20 Feb 2006 14:41 GMT
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).

Signature

Patrice

> Hi.
>
[quoted text clipped - 16 lines]
>
> Kimba
Kimba - 20 Feb 2006 21:46 GMT
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.Soap11ServerProtocolHelper.RouteRequest()

at
System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage
message)

at System.Web.Services.Protocols.SoapServerProtocol.Initialize()

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

> 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
[quoted text clipped - 28 lines]
>>
>> Kimba
Steven Cheng[MSFT] - 21 Feb 2006 02:21 GMT
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

Signature

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

Patrice - 21 Feb 2006 08:40 GMT
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...

Signature

Patrice

> Your suggestion works if I change them and then recompile my application.
>
[quoted text clipped - 23 lines]
>
> at

System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMess
age
> message)
>
[quoted text clipped - 36 lines]
> >>
> >> Kimba
Kimba - 21 Feb 2006 11:29 GMT
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.

> My suggestion is not about recompiling. It's just to tell that it should
> work either :
[quoted text clipped - 99 lines]
>> >>
>> >> Kimba

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.