Sunday, March 27, 2011

Re: can't get past beforeFilter()

I was tailing the log for the wrong virtual host! There was indeed a
fatal error.

Sorry for the noise.

On Sun, Mar 27, 2011 at 12:05 AM, cricket <zijn.digital@gmail.com> wrote:
> I've written a controller to handle a few XML-RPC requests, as well a
> a basic PHP client to test with. The data is being passed to the
> server ok but something's keeping the action from running. I've got
> log statements in both beforeFilter and the action itself, but the
> latter never show up in the log. Can anyone see anything I've missed?
>
> function beforeFilter()
> {
>        parent::beforeFilter();
>        $this->Auth->allowedActions = array('handle_request');
>        $this->layout = $this->autoRender = false;
>        Configure::write('debug', 0);
>        App::import('Vendor', 'kd_xmlrpc');
>
>        $this->log('beforeFilter');
>        $this->log($GLOBALS['HTTP_RAW_POST_DATA']);
>        $this->log($this->params);
> }
>
> function isAuthorized()
> {
>        return true;
> }
>
> /**
>  * Handle a request
>  *
>  * @access      public
>  * @param       void
>  * @return      void
>  */
> public function handle_request()
> {
>        $this->log('handle_request');
>        $data = XMLRPC_parse($GLOBALS['HTTP_RAW_POST_DATA']);
>        $this->log($data);
>
>        $method_name = XMLRPC_getMethodName($data);
>
>        if (!method_exists(__CLASS__, $method_name))
>        {
>                $this->__error(
>                        ERROR_XMLRPC_METHOD_NOT_FOUND,
>                        "The method you requested, ${method_name}, was not found."
>                );
>        }
>
>        $params = XMLRPC_getParams($data);
>
>        $this->setAction($method_name, $params);
> }
>
>
> The log gets:
>
> -- snip --
> 2011-03-26 23:37:05 Error: beforeFilter
> 2011-03-26 23:37:05 Error: <?xml version="1.0" ?>
> <methodCall>
>        <methodName>memberExists</methodName>
>        <params>
>                <param>
>                        <value>
>                                <string>test@test.com</string>
>                        </value>
>                </param>
>        </params>
> </methodCall>
>
> 2011-03-26 23:37:05 Error: Array
> (
>    [pass] => Array
>        (
>        )
>
>    [named] => Array
>        (
>        )
>
>    [plugin] =>
>    [controller] => member_rpcs
>    [action] => handle_request
>    [form] => Array
>        (
>        )
>
>    [url] => Array
>        (
>            [url] => members/rpc
>        )
>
> )
> -- snip --
>
> That's it--nothing from the action itself. I also added, right after
> App::import(...)
>
> $this->log(XMLRPC_parse($GLOBALS['HTTP_RAW_POST_DATA']));
>
> ... and it looked fine. So there's no trouble with loading the vendor file.
>
> I'm trying to figure out the best way to monitor what's happening
> inside the controller. It seems to me that Auth shouldn't be
> interfering, but I guess that's a possibility. But I'm not sure how to
> check that, either.
>
> This is the library I'm using, if anyone's interested:
> http://keithdevens.com/software/xmlrpc
>

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: