2 Replies Latest reply: Sep 15, 2015 10:01 AM by Janna Meyer RSS

    How to fix problem with sendJsonRequest promise in connectdialog.js?

      I've made several little changes in my connector and now it can't send JsonRequest to server.


      $scope.onTestConnectionClicked = function () {

           console.log("testConnection init");

           var promise = input.serverside.sendJsonRequest("testConnection", $scope.username, $scope.password);



           console.log("testConnection promise generated");


           promise.catch(function(a) {

               console.log("Catched ex");




           promise.then( function ( info ) {

              $scope.connectionInfo = info.qMessage;

             $scope.connectionSuccessful = info.qMessage.indexOf( "OK" ) !== -1;

          } );



      Error I get, when onTestConnectionCliked function fires:


      Error from Engine: Object {jsonrpc: "2.0", id: 51, error: Object}

      Error object: code: -1 message: "Unknown error" parameter: "General exception"


      My HandleJsonRequest method, from class QvAmoCrmServer (extends QvxServer)

      (Two implementations, same effect)


      First one:


            public override string HandleJsonRequest(string method, string[] userParameters, QvxConnection connection)


                  QvDataContractResponse response;



                  QvxLog.Log(QvxLogFacility.Application, QvxLogSeverity.Debug, "Handle json Request > " + method);



                  string provider, host, username, password;

                  connection.MParameters.TryGetValue("provider", out provider); // Set to the name of the connector by QlikView Engine

                  connection.MParameters.TryGetValue("userid", out username); // Set when creating new connection or from inside the QlikView Management Console (QMC)

                  connection.MParameters.TryGetValue("password", out password); // Same as for username

                  connection.MParameters.TryGetValue("host", out host); // Defined when calling createNewConnection in connectdialog.js



                  switch (method)


                      case "getInfo":

                          response = getInfo();


                      case "getDatabases":

                          response = getDatabases(username, password);


                      case "getTables":

                          response = getTables(username, password, connection, userParameters[0], userParameters[1]);


                      case "getFields":

                          response = getFields(username, password, connection, userParameters[0], userParameters[1], userParameters[2]);


                      case "testConnection":

                          response = testConnection(userParameters[0], userParameters[1]);



                          response = new Info { qMessage = "Unknown command" };



                 return ToJson(response);    // serializes response into JSON string




      And another:


               public override string HandleJsonRequest(string method, string[] userParameters, QvxConnection connection)



                  return JsonConvert.SerializeObject(new Info {qMessage = "Test response"});




      Error screenshot: Program Manager (271 kb) закачан 11 июня 2015 г. Joxi