Scenario: I run the code on a client that connects to the server and uses the web service to retrieve the SharePoint list data. I am using the Visual Studio 2010 service link to get the web service for my SP site and get my data from the list. It is working. Now, how can I code it so that when I want to switch from Test to Production, my web service calls will work? Please note that the web service is a SharePoint web service, I am not writing it. I use it only. Is it possible? I have the opportunity to make sure that the site is the same (with the exception of URLS) in both environments (for example, backing up the SP site and creating it). Thanks for any suggestions.
Summary:
Basically I am looking for a better way to go from test to production without recompiling my code that uses the SP web service. Also, as a side note, if anyone knows how similar the sites of the test / production access point are, [so that the web service works with both and changing the URL) .. this would be useful .
Decision
You can use the project configuration file to specify the location of the web service. The .svcdatamap files and other files in the VS project are for development-time use only, and the URL that is actually used to connect to the SharePoint web service is passed as an argument to the System.Data.Services.Client.DataServiceContext object. This is only tangent, but to create your own WCF web service, see Link. BTW, the web service will work without recompiling anywhere in the SharePoint list that has the same list name, and the column you request has the same name.
Kylem source share