Wednesday, 15 February 2012

Getting "error"=>"Array" array response from python JSON server and PHP client -



Getting "error"=>"Array" array response from python JSON server and PHP client -

i've written simple json rpc server in python interface python program. server works fine when utilize curl to manually build json requests it. when utilize json library here: http://jsonrpcphp.org/ error response "array" in return.

i'm not sure i'm doing wrong, because i've tested server , works when don't utilize php library.

i've check , content type set "application/json".

heres php code:

$server= new jsonrpcclient("http://$serveraddress:$port"); seek { echo($server->do_stop()); } grab (exception $e) { echo "caught exception: ", $e->getmessage() ,"<br />"; }

edit:

here's print_r of $server object (localhost should have http:// before can't set in):

jsonrpcclient object ( [debug:jsonrpcclient:private] => [url:jsonrpcclient:private] => localhost:3000[id:jsonrpcclient:private] => 1 [notification:jsonrpcclient:private] => [proxy] => )

do_stop() raises exception "request error: array"

edit2: solved rpoblem, turns out requesting wrong method. forgot changed name stop().

logic errors...

construct ur object setting debug flag true

$server= new jsonrpcclient("http://$serveraddress:$port", true);

reading source code of json rpc client, seems error coming ur server:

// final checks , homecoming if (!$this->notification) { // check if ($response['id'] != $currentid) { throw new exception('incorrect response id (request id: '.$currentid.', response id: '.$response['id'].')'); } if (!is_null($response['error'])) { throw new exception('request error: '.$response['error']); } homecoming $response['result']; } else { homecoming true; }

php python json client rpc

No comments:

Post a Comment