Change url of web service at runtime

G

Gujju

Is that possible in .net to change the target web service at runtime. ie.
change the URL and access a different web service totally. which does totally
different things but has the same Definition.

IE Service1.asmx WEBMETHOD(BYVAL as Integer)
Server2.asmx WEbMETHOD(Byval as integer)
Service3.asmx WEbmethod(byval as integer) and so on....

I know its possible with SOAP TOOLKIT. But i dont want to use that. Is that
possible in VB.net ??
Just to change the URL everytime?

Cheers
C
 
Y

Yunus Emre ALPÖZEN [MCSD.NET]

u should write your own service wrapper; which derives
System.Web.Services.Protocols.SoapHttpClientProtocol.. and modify url
property...
 
C

Chris Hayes

Sounds too simple, but if you've set the WebService as a Web Reference in
your project and you are instantiating the WebService, there is a URL
property that you can access to either get or set your URL. As long as your
signatures match the WebService you have referenced in your project, it
should be ok. (I tested this out and looks like it works to me).

Dim SomeWebService.Service1 ws As new SomeWebService.Service1()
ws.Url = "http://localhost/SomeWebService/Service3.asmx" (or ws.Url =
SomeStringVariable)

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top