0 Replies Latest reply: Aug 2, 2016 1:56 PM by Jason Scheiwiller RSS

    Constructor for QMSClient Object throwing exception (C#.net)

    Jason Scheiwiller

      I'm trying to create a QMSClient object using the constructor that accepts [string endpointConfigurationname, string remoteAddress]. When executing the code the following exception is thrown

       

      "An unhandled exception of type 'System.InvalidOperationException' occurred in System.ServiceModel.dll

       

      Additional information: Could not find endpoint element with name 'BasicHttpBinding_IQMS' and contract 'QMSAPIService.IQMS' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element."

       

      I have successfully connected to the server I entered in the remoteAddress parameter using the default constructor for the QMSClient, but for some reason when I use this constructor it throws the exception. I followed the instructions in the QMSAPI Documentation under the service key injection example. The reason I wish to use this constructor is so I can have a parameterized server address as I will need to change between the target QlikView server on different executions of my program.

       

      As I said I have connected successfully with the default constructor, meaning my service reference and config file have been configured properly. Here is a snippet of my code:

       

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

      ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();

       

      Any help is greatly appreciated.

       

      EDIT: I have now successfully connected to the original server using the constructor mentioned, my new problem is that when trying to connect to a different server, an exception is thrown on the next line when attempting to generate a service key for the QMSClient object.

       

      ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();

      The exception is as follows

       

      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 am following the QMSAPI Documentation instructions and am not seeing any directions to update the config file or ServiceSupport files when attempting to connect to a different server. I hope to make advances on this soon.