Dynamically Routing Web Services Requests to another Install of CRM

Less than one minute read time.
In the Web Services API of the Sage CRM the webservices class itself has a string property called "Url".

The URL property contains the URL location to which the SOAP requests are directed. It does not contain the pointer to the WSDL, this is set in the web reference of the project and the definitions used are fixed within the compilation of the program.

(Code examples below are in C#)

Consider if you have set the following web reference for your WSDL file:

http://localhost/CRMdemo/eware.dll/webservice/webservice.wsdl

WebService myCRM = new WebService();

myCRM.Url is going to contain

http://localhost/crmdemo/eware.dll/WebServices/SOAP

Given that we can not (easily) dynamically easily change the definitions provided by WSDL file we can however dynamically redirect our requests to another install of CRM.

WebService myCRM = new WebService();
String strCRMURL = "http://localhost/crmanother/eware.dll/webservices/soap";

This allows us to root requests to a particular CRM install.

Note: The WSDL of the dynamically addressed install must be compatible with the WSDL file that was used as the original web reference for your project.