Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

remotecontrol not working: uncaught exception

  • tvanover
  • tvanover's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 6 months ago #126317 by tvanover
Hi,

I've followed the guidelines to enable json rpc here:

manual.limesurvey.org/RemoteControl_2_API#add_participants

I created the php example file:

<?php

// without composer this line can be used
// require_once 'path/to/your/rpcclient/jsonRPCClient.php';
// with composer support just add the autoloader
include_once 'vendor/autoload.php';

define( 'LS_BASEURL', ' xxx.be/limesurvey/ '); // adjust this one to your actual LimeSurvey URL
define( 'LS_USER', 'admin' );
define( 'LS_PASSWORD', 'xxxxxx' );

// the survey to process
$survey_id=425522;

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

// 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 );

?>

But when I try to test it, I get this error:

PHP Fatal error: Uncaught exception 'Exception' with message 'Incorrect response id: (request id: 1)' in C:\Inetpub\Venice-Blog\limesurvey\vendor\weberhofer\jsonrpcphp\src\org\jsonrpcphp\JsonRPCClient.php:185
Stack trace:
#0 C:\Inetpub\Venice-Blog\limesurvey\rpc-connect.php(19): org\jsonrpcphp\JsonRPCClient->__call('get_session_key', Array)
#1 C:\Inetpub\Venice-Blog\limesurvey\rpc-connect.php(19): org\jsonrpcphp\JsonRPCClient->get_session_key('admin', 'xxx')
#2 {main}
thrown in C:\Inetpub\Venice-Blog\limesurvey\vendor\weberhofer\jsonrpcphp\src\org\jsonrpcphp\JsonRPCClient.php on line 185

Any ideas? I think the jsonrpc client package was correctly installed (and found by limesurvey). The user / password combo is correct.

I'm running Version 2.06+ Build 150911

Thanks,
Tom
The topic has been locked.
More
8 years 6 months ago #126587 by mellorine
Replied by mellorine on topic remotecontrol not working: uncaught exception
I got the same error when I forgot to enable JSON-RPC in Global Settings. Are you sure you enabled it? Just a thought.

"Go to Global settings, choose the tab 'Services' and select one of the two RPC services (XML-RPC or JSON-RPC) service."
The following user(s) said Thank You: ashna
The topic has been locked.
  • tvanover
  • tvanover's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
8 years 6 months ago - 8 years 6 months ago #126593 by tvanover
Replied by tvanover on topic remotecontrol not working: uncaught exception
I've found it. base url was wrong (does that mean the example code is wrong, or is it a windows <> unix thing ,

anyway, this is what baseurl should like for me:

xxx.example.org/limesurvey/index.php?r=admin/remotecontrol
Last edit: 8 years 6 months ago by DenisChenu. Reason: example.org is done for this
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 months ago #126614 by holch
Well, Windows doesn't have url rewriting via htaccess i guess?

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 6 months ago #126629 by DenisChenu
Replied by DenisChenu on topic remotecontrol not working: uncaught exception
The url shown in your admin GUI is this one or not ?

If the url shown is false : please report a bug

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
More
4 years 11 months ago #184510 by bes1252
Replied by bes1252 on topic remotecontrol not working: uncaught exception
make sure you have http :// or https:// to your base_url (in my case this was the error)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose