【问题标题】:Fatal error: Uncaught exception 'Exception' with message 'Incorrect response id: (request id: 1)'致命错误:未捕获的异常“异常”,消息“不正确的响应 ID:(请求 ID:1)”
【发布时间】:2016-09-06 07:35:57
【问题描述】:

我正在使用 Limesurvay github.com/trougakoss/LimeSurveygithub.com/weberhofer/jsonrpcphp 并且测试代码是

require_once 'C:/wamp/www/limesurvey/jsonrpcphp/src/org/jsonrpcphp/jsonRPCClient.php';
define( 'LS_BASEURL', 'http://10.10.10.29:823/limesurvey/index.php?r=admin/remotecontrol');  // adjust this one to your actual LimeSurvey URL
define( 'LS_USER', 'admin' );
define( 'LS_PASSWORD', 'admin' );

// the survey to process
$survey_id=989315;

// instanciate a new client
$myJSONRPCClient = new \org\jsonrpcphp\JsonRPCClient( LS_BASEURL);

//echo $myJSONRPCClient->getinfo();
// receive session key
$sessionKey= $myJSONRPCClient->get_session_key( LS_USER, LS_PASSWORD );

// receive all ids and info of groups belonging to a given survey
$groups = $myJSONRPCClient->list_groups( $sessionKey, $survey_id );
print_r($groups, null );

// release the session key
$myJSONRPCClient->release_session_key( $sessionKey );

并得到这些错误:输出结果

( ! ) Fatal error: Uncaught exception 'Exception' with message 'Incorrect response id: (request id: 1)' in C:\wamp\www\limesurvey\jsonrpcphp\src\org\jsonrpcphp\JsonRPCClient.php on line 185

( ! ) Exception: Incorrect response id: (request id: 1) in C:\wamp\www\limesurvey\jsonrpcphp\src\org\jsonrpcphp\JsonRPCClient.php on line 185

Call Stack
#   Time    Memory  Function                                            Location
1   1.0022  252616  {main}( )                                           ..\test.php:0
2   1.0032  295944  org\jsonrpcphp\JsonRPCClient->get_session_key( )    ..\test.php:25
3   1.0032  296360  org\jsonrpcphp\JsonRPCClient->__call( )             ..\test.php:25

【问题讨论】:

    标签: php json-rpc limesurvey


    【解决方案1】:

    当我忘记在全局设置中启用 JSON-RPC 时,我遇到了同样的错误。你确定你启用了吗?只是一个想法。

    “转到全局设置,选择“服务”选项卡并选择两个 RPC 服务(XML-RPC 或 JSON-RPC)服务之一。”

    https://manual.limesurvey.org/Global_settings

    【讨论】:

    • 看来你回答了你的问题……
    【解决方案2】:

    我遇到了同样的错误,这是因为我在常规设置中选择了 XML API 而不是 JSON API。

    【讨论】:

      猜你喜欢
      • 2015-07-10
      • 1970-01-01
      • 2015-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-09
      • 1970-01-01
      • 2014-08-26
      相关资源
      最近更新 更多