Note that there are some explanatory texts on larger screens.

plurals
  1. POZend JSON server not returning content
    primarykey
    data
    text
    <p>I have a zend JSON factory that is designed to distribute OTPs for a service, however I cannot get the server to actually return anything..</p> <pre><code>&lt;?php class Application_Model_FrogconnectOTP { /** * Generates, stores, and returns the OTP for thesupplied user * * @param string $username * @return string */ public function generate($username) { $hash = "Lol"; return $hash; } /** * Will clear the OTP for the user. * * @param string $username * @return int */ public function delete($username) { return 1; } /** * Takes the supplied username and hash and will calculate new sums and verify the supplied hash. * * @param string $username * @param string $hash * @return int * */ public function validate($username, $hash) { return 1; } } ?&gt; </code></pre> <p>And this class is loaded by the default(ish) zend json server that looks like the following:</p> <pre><code>&lt;?php $this-&gt;_helper-&gt;layout-&gt;disableLayout(); $server = new Zend_Json_Server(); $OTPEngine = new Application_Model_FrogconnectOTP(); $server-&gt;setClass($OTPEngine); if ('GET' == $_SERVER['REQUEST_METHOD']) { // Indicate the URL endpoint, and the JSON-RPC version used: $server-&gt;setTarget('/frogconnect') -&gt;setEnvelope(Zend_Json_Server_Smd::ENV_JSONRPC_2); // Grab the SMD $smd = $server-&gt;getServiceMap(); // Return the SMD to the client header('Content-Type: application/json'); echo $smd; return; } $server-&gt;handle(); </code></pre> <p>However if I try to make a request with a json string that looks similar to the following, the server responds with a 204 No Content header, but I receive no content (I should be expecting "Lol"</p> <pre><code>{"method":"generate","params":{"username":"johndoe"}} </code></pre> <p>Any help would be appreciated</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload