Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand correctly, I think you just need to write some code to decide on the URL based on some property... for now we'll say the querystring, although you might want to have a more secure method. </p> <p>I would:</p> <ol> <li>Add a new Setting to the config</li> <li>Add the setting to the settings file</li> <li>Rename the existing webservice</li> <li>Override the renamed webservice with the old name</li> <li>Write some code to do the URL-switch.</li> </ol> <hr> <ol> <li><p>Add the setting to the config: http://SVC1/cms-webservice/cms-webservice http://SVC1/cms-webservice/cms-test-webservice </p></li> <li><p>Add the new setting into your project/Properties/Settings.settings file</p></li> <li><p>Rename the class generated by Visual Studio by highlighting it in Solution Explorer, pressing F2, and giving it a different name, e.g. <code>CmsWebServiceBase</code></p></li> <li><p>Now override the web service class that was generated by Visual Studio:</p> <pre><code>public class CmsWebService : CmsWebServiceBase{ } </code></pre></li> <li><p>Code switching logic in constructor:</p> <pre><code>public CmsWebService(){ // figure out if we should use Test or Live if( HttpContext.Current != null ){ if( HttpContext.Current.Request.QueryString["test"] == "true" ){ HttpContext.Current.Session["test"] = "true"; } if( HttpContext.Current.Session["test"] == "true" ){ this.Url = MyProject.Properties.Settings.CM_MVC_CmsService_cms_webservice_test; } } } </code></pre></li> </ol> <p>Note that this will cause problems if you do async processing, or anything else fancy where you use the WebService but Session is not available. </p> <p>Hope that helps!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload