Last post Jul 25, 2013 04:12 AM by PatriceSc
Jul 24, 2013 07:12 AM|ramana123|LINK
we are consuming the web service written by other company; we are in the DEV stage now so we are adding and rebuilding the client app everytime when third party comany modifies the web service or add extra features and also moving from one env to another
env (like dev -> test -> stage etc).
I would like to avoid the dependency of rebuilding the client when we change the env to env if there is no change in WSDL but ony URL of the web service changes.
I remember setting something like URL property of the proxy object but someone thwos light on these lines?
Jul 24, 2013 07:23 AM|PatriceSc|LINK
Try http://support.microsoft.com/kb/316928/en-us to see how to save the service location in the web.config file so that you can change this location easily...
Jul 24, 2013 07:31 AM|ramana123|LINK
Thanks for reply; I have done this..but I am consuming the webservice in a DLL hence its setting up in DLL project properties; this DLL will be used in many client apps to call web service;
question is, if I change the service in DLL project propeties will all the clients who ever calling web service with this DLL will be redirected?
every time i change the url in project properties do I need to rebuild the DLL and use it in client app?
Jul 24, 2013 02:38 PM|PatriceSc|LINK
Even in a DLL project, Visual Studio still creates an application config file as it has to get some support even in design time mode.
At runtime, the configuration file which is used is the one for the application that uses this DLL so usually you just carry over those settings to the application config file.
At this step you'll be able to change those settings by updating the application config file. Does it work until this step ?
If needed you can always implement more sophisticated custom scenario to keep this setting at a central location (iit could goes from referencing a single config file that holds this settings from all the other config files, to having a service to which
you can ask for the conifguration of other general services etc...)
Jul 25, 2013 12:00 AM|ramana123|LINK
Since I am using the webservice ref in DLL the DLL app.config have the sectiion to change the URL of webservice; but, when we add ref of this DLL into actual clients the app.config will not be carry forward right? or it does? may be I am missing some basics
when add the DLL ref in client apps and deploy client app I could see only web.config but nowhere the DLL's app.config carry forarded at the same time web.config doest have URL key values seems obvious thing.
So, how to change the URL of the web servicve in this scenario and where?
Jul 25, 2013 02:45 AM|ramana123|LINK
I have changed the References.cs file this.URL section to read it from web.config of any application who uses this DLL instead of project properties.
like => this.url - System.ConfigurationManager.Appsettigns[KYE1] [this key will there in all clients who uses this dLL to connect to Web Service]
and it worked very wel; only disadvantage is if the WSDL changes then this has to be done again ; as long as wsdl not changed this will work perfectly;
I guess in any case you need to rebuild your DLL if the WSDL is changing like adding the web reference again.
So its okay I guess; any comments?
Jul 25, 2013 04:12 AM|PatriceSc|LINK
I meant it should be done for you when choosing Dynamic in the property window :
http://www.codeproject.com/Articles/12317/How-to-make-your-Web-Reference-proxy-URL-dynamic (though inside a class library it likely stores this setting inside an inner section to avoid a possible name setting conflict accross DLLs).
When the WSDL changes, you anyway have to recreate the whole service proxy to take advantage of its new methods.
Not sure how this is handled by this third party but I would say that usually the old service is kept unchanged and the new version is published at a new location so that old clients can still run and so that you can upgrade as and when needed...