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?

0


a source to share


3 answers


Can't test in VS2005, but I know that in 2008 when deploying a web application, it puts the service URI in the Settings.settings file in the Properties directory. You can change the URI to point to the test instance of the service there and restart your application.



0


a source


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.

0


a source


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

0


a source







All Articles