views:

5

answers:

0

I am trying to serve up my user repository via zend_json_server. The problem is the service is returning empty objects. What have i missed? server side:

$repo = App_User_Repository::getInstance();

  $server = new Zend_Json_Server();
  $server->setClass($repo);

  if ('GET' == $_SERVER['REQUEST_METHOD']) {
      $server->setTarget('/service/json-rpc.php')
             ->setEnvelope(Zend_Json_Server_Smd::ENV_JSONRPC_2);
      $smd = $server->getServiceMap();

      // Set Dojo compatibility:
      $smd->setDojoCompatible(true);
      header('Content-Type: application/json');
      echo $smd;
      return;
  }

  $server->handle();

client side:

    var object = new dojo.rpc.JsonService('/service/json-rpc.php');
    var deferred = object.getById(1);
    deferred.addBoth(function(result) {console.log(result)});

Firebug console output:

 Object {}

This should be a User object