views:

249

answers:

4

We have an web app that is talking to Netsuite via Netsuite's web services. We setup the Web Service via VS 2005's Add Web Reference wizard which generates all the proxy code.

Netsuite have sandbox accounts that allow testing (a different web reference URL). Ideally we want to hop back and forth between the live service and the test service. I am hoping that I can just change an 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&lt;/value&gt;
        </setting>
    </Netsuite.Properties.Settings>

but the web reference URL is https://webservices.netsuite.com/wsdl/v2008_2_0/netsuite.wsdl

Has anyone tried this and know how to do this?

A: 

You could put the WebService URL in the 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 WebService URL without recompiling the application.

Mun
This would require a recompile. We have the app deployed already and need to change the URL.
woaksie
Looks like I have no choice but to use this solution.
woaksie
A: 

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

Wayne Hartman
A: 

I'm missing something. What happens if you change the URL in the config file?

John Saunders
A: 

I do this frequently with NetSuite integration appls without needing to recompile. Swap out your service value in your config file to

https://webservices.sandbox.netsuite.com/services/NetSuitePort_2008_2

if you were using this value for production:

h ttps://webservices.netsuite.com/services/NetSuitePort_2008_2

Mark Simon