Sharepoint 2007: How to change the native URL of a web part web service?
I have a MOSS 2007 web part that displays data retrieved from an external web service (not from sharepoint).
Built using VS2009, the webpart project includes a WebReference in my WebService and uses the following code to connect (URL configured in WebReference):
//get xml sitemap from webservice
MenuService.MenuService service = new MenuService.MenuService();
service.Credentials = System.Net.CredentialCache.DefaultCredentials;
XmlNode sitemapRootNode = service.GetSiteMapXML();
I compiled the web part, deployed it in the BIN folder, everything works fine.
However, I cannot change the url of the web service ... If I want to move the webpart to a different environment, I need to recompile the whole thing to change the url of the web service
Also, when I compile the webpart projects, it creates a webpartname.dll.config file that contains the URL of the web service ... however these config files do nothing. If I change it, or just delete it from the BIN folder, the webpage still connects to the old url ... the url seems to be hardcoded in the web part DLL.
Is there a way to customize the web page to appear in the config file for its web service url?
source to share
There's also SPConfigStore . This is a good solution if you have multiple servers in your farm and you want to maintain the web service URL in a central location stored in a SharePoint database.
source to share