2010年4月21日星期三

[fw-webservices] Re: Debugging Zend_XmlRpc_Server

Thank you for your response, Matthew.  I keep running into your articles and forum threads while trying to figure this out and never would have gotten this far without them.  I believe the docblocks are set up correctly.

For instance, here is the method:

    /**
    * Get one contact
    *
    * @param string $contacts_email
    * @return string
    *
    */
    function getContactInfo($contacts_email) {
        $acl = Zend_Registry::get('acl');
        $clientDb = Zend_Registry::get('client_db');
       
        $contact = DatabaseObject_Contact($clientDb);
        //$contact->load($contacts_email, 'contacts_email');
       
        return $contacts_email . ' back from server <br>';
    }

Here is the call from the client:

$token = '1';
$arg1 = [hidden email]';
print_r($client->call('service.getContactInfo', array($token, $arg1)));

I used your advice in another thread to set up a custom Response object for Acl authentication, so that strips out the $token parameter.  For Zend_Registry, 'acl' is set in the bootstrap and 'client_db' is set in the custom Response object.  If I echo out client_db, it looks correct.

If I comment out the line $contact = DatabaseObject_Contact($clientDb); then I get the expected response (it echos "[hidden email] back from server").

Thanks,
~Laura


On Wed, 2010-04-21 at 09:04 -0800, weierophinney [via Zend Framework Community] wrote:
-- Laura Dean <[hidden email]> wrote
(on Wednesday, 21 April 2010, 08:32 AM -0800):

> I have my server and client both basically working on a "hello world" level.
> Now I'm trying to add the good stuff.  The problem is that I'll change
> something in my web service, and get an exception like this:
>
> ( ! ) Warning: SimpleXMLElement::__construct()
> [function.SimpleXMLElement---construct]: Entity: line 2: parser error :
> Extra content at the end of the document in
> /data/lib/Zend/ZendFramework-1.10.2/library/Zend/XmlRpc/Response.php on line
> 180
> Call Stack
> # Time Memory Function Location
> 1 0.0003 60988 {main}( ) ../xmlrpc_test.php:0
> 2 0.1881 10109712 Zend_XmlRpc_Client->call( ) ../xmlrpc_test.php:24
> 3 0.9383 10836620 Zend_XmlRpc_Client->doRequest( ) ../Client.php:364
> 4 1.6136 10845916 Zend_XmlRpc_Response->loadXml( ) ../Client.php:300
> 5 1.6137 10845916 SimpleXMLElement->__construct( ) ../Response.php:180
>
> When I print_r on $response from within the loadXml() function, it looks
> like this:
>
> faultCode623faultStringCalling parameters do not match signature

Two things to look at:

 * Have you created your method docblock correctly? I.e., have you
   created @param and @return annotations? And do they specify the
   correct variable types?

 * Assuming the answers to the above questions are "yes", do the types
   you're passing in your client request match those in the docblock?

As an example, if you have the following method:

    function foo(array $bar, $flag) {}

then you want to make sure it has a docblock, which might look like
this:

    /**
     * @param  array $bar
     * @param  bool $flag
     * @return string
     */
    function foo(array $bar, $flag) {}

When you make your request, you'd want to ensure that the parameters you
send are an array and a boolean, respectively.

Check this information, and then report back to the list what you find.

> But if I take out the offending line of code then it doesn't complain about
> parameters.  I am trying to create a DatabaseObject, which is my custom
> "interface with mySQL" class.  There might be an error creating the
> DatabaseObject (maybe the database isn't configured correctly or something
> else), but that's the error I need to see, not "Calling parameters do not
> match signature"
>
> I tried the advice from this thread,
> http://osdir.com/ml/php.zend.framework.general/2007-06/msg00383.html , but
> it looks like the exception is thrown before I can get any useful
> information into the log.
>
> Any suggestions for me?

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc



View message @ http://n4.nabble.com/Debugging-Zend-XmlRpc-Server-tp2019242p2019301.html
To unsubscribe from Debugging Zend_XmlRpc_Server, click here.



View this message in context: Re: Debugging Zend_XmlRpc_Server
Sent from the Zend Web Services mailing list archive at Nabble.com.

没有评论: