Zend Framework 2 JSON-RPC Invalid Request

511 views Asked by At

i'm running into some problems trying to implement JSON-RPC server under the Zend Framework 2 using the official documintation

i have created the calculator class under my application/model/calculator.php but in the application/controller/indexController.php i have unsuccessfully being able to handel the server request:

public function indexAction(){
  $server = new \Zend\Json\Server\Server();
  // Indicate what functionality is available:
  $server->setClass('Application\Model\Calculator');
  // Handle the request:
  $server->handle();
  $view = new ViewModel();
  return $view;
}

and getting the following error:

{"error":{"code":-32600,"message":"Invalid Request","data":null},"id":null}

needless to say i have not found any good tutorials on the web of implementing JSON-RPC to zend framework2.

1

There are 1 answers

0
neko On

i used zf1 for that and considering using zf2.

the only advice is to check request, maybe u not using the named arguments. whatever, just debug the zf2 source cause why not.