WebService update

F

Franck

Here im talkign about a windwos application usign webservice on
external server.
I want to know how to update at runtime the webservice object of my
applciation to point out to different ip. What we tried so far is a
crypted xml file local to the application that read it at startup and
we overide the webserviceobject.service() to pass a string url to it.
it does work if we hard code the string in it but not by getting it
from a external file.

We tried playing with app.config and settings.settings with no result.
Inside visual studio it work but by executable it doesn't.

anyone know how to solve that or any advance webservice links ?
 
N

Nicholas Paldino [.NET/C# MVP]

Franck,

If you used the "add web reference" menu option to generate the proxy,
then the class should derive from the SoapHttpClientProtocol class (or some
other derivative of WebClientProtocol). You can just set the Url property
on the proxy before you make any calls on it, and it should work.
 
M

Mr. Arnold

Franck said:
Here im talkign about a windwos application usign webservice on
external server.
I want to know how to update at runtime the webservice object of my
applciation to point out to different ip. What we tried so far is a
crypted xml file local to the application that read it at startup and
we overide the webserviceobject.service() to pass a string url to it.
it does work if we hard code the string in it but not by getting it
from a external file.

What? You got a Webservice.cs that was built using the .Net WSDL.exe?
We tried playing with app.config and settings.settings with no result.
Inside visual studio it work but by executable it doesn't.
App.config is just another XML file.

You got two chocies to read the app.conflg:

1) You create a routine on a Timer and read the app.comfit periodically to
pick up new settings, using an XML Document object, to pick-up the new URL.

2) You use .Net 2.0 Framework ConfigurationManager in the
System.Configuration to read values in the <ConfigSettings> in the
app.config, which would hold the URL. You would use a SystemFileWatch to
detect any change in the app.config to pickup new changes.

With option #2, if you download the .Net 2.0 Framework Application Blocks
and look at the XML and app.config examples, you'll see exactly how to do
it. There is nothing no DLL(s) that need to be installed that happen .Net
1.1, becuase it's all incorporated in .Net 2.0. All you need is to see the
example project in the download, and just rip it out and run with it.

anyone know how to solve that or any advance webservice links ?

I used Option #2 in a Console and Windows Service applications to pull in
new settings to those applications on the fly, when I made a change to a
setting in the app.config.

I just came off a Web Service client project, and Option #2 would be no
problem in a Web Service client application to point to a different URL that
was in the app.config, when the setting in the app.config changed.
 

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

Top