2010年4月21日星期三

Re: [fw-webservices] Debugging Zend_XmlRpc_Server

-- Laura Dean <ldean@saleamp.com> 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 | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

没有评论: