0 Replies Latest reply: Aug 17, 2016 4:34 PM by Jason Scheiwiller RSS

    Connect to different servers without recreating/requiring multiple service references (QMS API) (C# Visual Studio)

    Jason Scheiwiller

      Hi I am trying to use the QlikView Management API to interact with different QlikView servers without having to recreate or create an additional service reference. We have multiple servers (dev, production) and I wish to basically be able to programmatically switch between these servers while reusing the same code. When I attempt to use the endpointConfigurationName and remoteAddress constructor to construct a QMSClient object connecting to a server different from the originally hard coded server in the service reference, I get an exception when trying to generate the service key.

       

      An unhandled exception of type 'System.ServiceModel.ActionNotSupportedException' occurred in mscorlib.dll

       

      Additional information: The message with Action 'http://ws.qliktech.com/QMS/12/IQMS/GetTimeLimitedServiceKey' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

       

      I know this is because the hard coded server URI in the service reference does not match the URI I specified as the remoteAddress in the constructor, my question is that is there some way to dynamically switch between these servers completely programmatically?

       

      The QMS API documentation mentions that this is the correct way to connect to a different server, and does not specify any additional steps:

       

      //If you want to connect to a server different from the one used when creating the service reference,

      //do as follows: 

      //

      //NTLM only (default installation)

      //IQMS apiClient = new QMSClient("BasicHttpBinding_IQMS", "http://remotehost:4799/QMS/Service");

       

      Does anyone have any ideas or has done this before? Thanks.