How can I change the url of a web service without recompiling?
We have a web application that talks to Netsuite via Netsuite web services. We configure the web service using the VS 2005 Add Web Links Wizard, which generates all the proxy code.
Netsuite has sandbox accounts that allow testing (different web link url). Ideally, we want to jump back and forth between the live service and the test service. I hope I can just change the xml file to point to the web service I want. The config file contains
<Netsuite.Properties.Settings>
<setting name="Netsuite_com_netsuite_webservices_v21_NetSuiteService"
serializeAs="String">
<value>https://webservices.netsuite.com/services/NetSuitePort_2008_2</value>
</setting>
</Netsuite.Properties.Settings>
but the url of the web link is https://webservices.netsuite.com/wsdl/v2008_2_0/netsuite.wsdl
Has anyone tried this and knew how to do this?
a source to share
You can put the WebService URL in your web.config (or AppSettings.config) file and then set it at runtime.
wsProxy proxy = new wsProxy();
wsProxy.Url = ConfigurationManager.AppSettings.Get("WebserviceUrl");
wsProxy.DoSomething();
This will allow you to change the URL of the WebService without recompiling your application.
a source to share
I do this frequently with NetSuite applications for integration without the need for recompilation. Change the value of your service in the config file to
https://webservices.sandbox.netsuite.com/services/NetSuitePort_2008_2
if you used this value for production:
h ttps: //webservices.netsuite.com/services/NetSuitePort_2008_2
a source to share