dynamic WebServices

C

Chankas

Hi everybody. I've developed an easy WebService with VStudio. I've developed
too a little Web application with VB.NET and I've created a WebReference in
order to use the WebService.

My question is: How can I especify that my Webapplication use the WebService
from other Web Server (nor localhot neither 127.0.0.1) without re-compile
it???


Thanks in advance and excuse muy English.

Chankas.
 
M

Manni

My English is not better then yours....(Austria) :)

If you just want to change the URI for the the Service....
This is a property, you can change it after creating the object.

TheSvcNs.MySvc sVC=new ........
sVC.Url=http://newServer.new.domain/other/path/someFile.asmx;

I do things like this in a project where we have a "master server", and some
"customer servers" (if the customer has it's own).

First is a call to the master (with credentials for the customer); form this
we get the
path to the customer server.
Next we split our paths (since we use different *,asmx) and replace the
servername
for every proxy with the new one!!

We don't store the path - the masterserver must tell it allways (licensing,
dynamic server changing).

HTH

Manfred
 
C

Chankas

Thanks Manni for your answer, but with this solution I'd have to recompile
my client application and I just want avoid it.

I've read some news where people explain that from VStudio enviroment it's
posible to change the behavior of the Web Service to "dynamic" and after
this I'd see in my config file a new entry where I could specify new ULR for
the WService.

I've just changed to "dinamyc" the behavior of my Web Reference and now I've
a folder called "Web References" with a subfolder called as my WebService
and inside it there're 4 files: WebService1.disco, WebService1.map,
WebService1.wsdl and WebService1.vb.
I've read this files and in all of them there're references to the URL of my
Web Service. I suposse that changing some of these references I won't have
to re-compile my client application.

Is this right?? Which of the four files have I that modify??


Thanks in advance. Chankas.
 
M

Manni

Sorry I dont think your approach would help!

But with my soultion you dont have to recompile!!!!!
Otherwise the "autorecovery" would not work!!!!

Assume, that you have a file (like you suggest), there your store the URL.
So when you start your app - read the URL from the file,
and store it somewhere common.
Let's say you have a class CallHelper with a static Member m_strURL.
If your webservices have more than one URL add more variables,
and more lines to your file!!
CallHelper reads the file (somewhere at the start of your programm) and
remembers
the URLs.

Next replace every single line where you write
MySvc.TheSvc svC=new svC();

With
MySvc.TheSvc svC=new svC();
svC.Url=CallHelper.m_strURL;

That is it - and don't have to recompile and so on!!
OK, you have to recompile - one time, after you made those changes!!!
But even with the change to "dynamic" you have that step to do since an
other
kind of proxy is generated!

HTH

Manfred
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top