You must Sign In to post a response.
  • Category: Webservices

    Consume-webservice-same-application-multiple-environment

    I have asp.net application.
    I need to consume a web-service url from config files.

    But I have three environments with 3 different urls like below

    http://test/webservice
    http://qa/webservice
    http://prod/webservice

    how to call this in different config files with same service name might be
  • #769296
    You can change only the URL of the web service based on your environment.
    Following are some of the technique that I am using in my application

    string WebServiceURLL = GetWebServiceURL(GetWOSystemEmployeesL.Url);
    GetWOSystemEmployeesL.Url = WebServiceURLL;


    private static string GetWebServiceURL(string WebserviceURLP)
    {
    // Check based on the QA/Production/etc..
    string zWebServiceServerL = System.Configuration.ConfigurationManager.AppSettings["FDCWebServiceServerBaseURL"];
    string WebServiceURLL = zWebServiceServerL + WebserviceURLP.Substring(WebserviceURLP.IndexOf('/', 7), WebserviceURLP.Length - WebserviceURLP.IndexOf('/', 7));
    return WebServiceURLL;
    }

    By Nathan
    Direction is important than speed


  • Sign In to post your comments