remotecontrol not working: uncaught exception

More
2 years 3 weeks ago #126317 by tvanover
tvanover created the topic: remotecontrol not working: uncaught exception
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

Please Log in to join the conversation.

More
2 years 2 weeks ago #126587 by mellorine
mellorine replied the 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."

Please Log in to join the conversation.

More
2 years 2 weeks ago - 2 years 2 weeks ago #126593 by tvanover
tvanover replied the 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: 2 years 2 weeks ago by DenisChenu. Reason: example.org is done for this

Please Log in to join the conversation.

More
2 years 2 weeks ago #126614 by holch
holch replied the topic: remotecontrol not working: uncaught exception
Well, Windows doesn't have url rewriting via htaccess i guess?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
2 years 2 weeks ago #126629 by DenisChenu
DenisChenu replied the 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now