Please excuse my ignorance as I've worked very little with any RPC service in
the past.

I'm attempting to AJAJ-enable a form. I've selected a simple form containing
2 ValidationTextBoxes. I'm using the modular directory structure and the
controller class in this case is Dashboard_Options and the action is
blogAction. The Dojo view integration is working as expected but I must be
missing something. I have created the getJsonRpcServer and jsonRpcAction
methods in the controller as described 
http://framework.zend.com/manual/en/zend.json.server.html here  (I
understand that this is but 1 potential solution):

Which seems to be calling the blogAction however I receive this error:

"Variable number of arguments is not supported for services (except optional
parameters). Number of function arguments must currespond to actual number
of arguments described in a docblock."

Sidebar: I copied and pasted the error message. What is the procedure for
submitting a a minor spelling mistake to the developers?

I understand that the methods are to contain docblocks so that the JSON-RPC
service knows the signature of the method but in this case there are no
arguments to the method nor a return value. Again, I must be missing
something but am at a loss. Any help would be greatly appreciated.

Here are the methods:

    /**

     * JSON-RPC Server setup

     */

    public function getJsonRpcServer()

    {

        // Disable auto-rendering and layouts

        $this->_helper->viewRenderer->setNoRender(true);

        $this->_helper->layout->disableLayout(true);

 

        $server = new Zend_Json_Server();

        $server->setTransport('POST')

            ->setTarget('/dashboard/options')

            ->setEnvelope(Zend_Json_Server_Smd::ENV_JSONRPC_2)

            ->setClass('Options');

 

        return $server;

    }

 

    public function jsonRpcAction()

    {

        $server = $this->getJsonRpcServer();

        $response = $this->getResponse();

 

        if ($this->getRequest()->isGet()) {

            $smd = $server->getServiceMap();

            $smd->setDojoCompatible(true);

            $response->setHeader('Content-Type', 'application/json')

                ->setBody($smd->toJson());

        } else {

            $result = $server->handle();

            $response->setBody($result->toJson());

        }

    }

 

    /**

     * Edit blog options

     */

    public function blogAction()

    {

        // Form setup & processing

        $form = $this->_helper->formLoader();

        $form->blog_hash->setSalt($this->salt);

        $form->populate($this->options->toArray());

        $request = $this->getRequest();

        if (($request->isPost()) && ($form->isValid($request->getPost()))) {

            // Save options and redirect

            $this->options->synchronizeWithArray($form->getValues());

            $this->options->save();

            $this->messenger->addMessage(self::BLOG_OPTIONS_SAVED);

            $this->redirector->gotoSimple('edit', 'options', 'dashboard'); 

        }

 

        // View variable assignment

        $this->view->form = $form;

    }

-- 
View this message in context: 
http://www.nabble.com/Dojo-%2B-JSON-RPC-tp19033900p19033900.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to