|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Zend_XmlRpc and base64Hi, I’m using Zend Framework 1.0.2, and I’m trying
to use the Zend_XmlRpc server and client for a method with 1 parameter, which
is an image. I think that has to be sent as a base64 encoded string. So I wrote a test method like this to expose on the server : /** *
Enter description here... * *
@param base64 $data *
@return base64 */ public
function setAvatar($data) { return
$data; } Now when I try to call that function using Zend_XmlRpc_Client
using the following code : $client = new Zend_XmlRpc_Client("…"); $avatar = array( 'type'
=> 'base64', 'value'
=> file_get_contents('avatar.jpg') ); $response
= $client->call("setAvatar", array($avatar)); I get the fault : Calling
parameters do not match signature What I did client side to solve the problem: -
First I tried setting the parameter like this : -
Once I got the first problem figured out it sent
an empty base64 parameter. That resulted in a correct request. But I still got the fault : Calling parameters do not
match signature So I started investigating the server side. I noticed that the type “base64” was lost and
replaced with string by the time the parameters were checked against the signature
of the method. But the base64 was also decoded by that time, so I changed
the docblock of the function into : /** *
Enter description here... * *
@param string $data *
@return base64 */ public
function setAvatar($data) { return
$data; } And that did the trick to remove the fault (Calling parameters do not
match signature). Only the response was sent as string, instead of base64. But luckily I don’t need that, I’ll just return
a Boolean. Is all this a bug, or am I just doing something wrong? Regards, Lode
Blomme Developer
RouteYou Kerkstraat
108 9050
Gentbrugge - Belgium Tel:
+32 (0) 479 220 783 Fax:
+32 (0) 70 400 961 Email:
lode.blomme@... Website:
http://www.routeyou.com |
|
|
Re: Zend_XmlRpc and base64This Issue "Calling parameters do not match signature" is till can be found in Zend Framework 1.5 RC 1.
One part of issue is in Zend_XmlRpc_Request, in loadXml method. It's parses XML to params (protected member $_params) and saves them as native PHP array with native PHP types. So at this part information about base64 in RPC request is lost. Second part of this Issue is in Zend_XmlRpc_Server, in _handle method. It's uses params array from Request (Zend_XmlRpc_Request, witch has native PHP types) and compares them with RPC method's Reflection data (where it has base64). Here we got this "Calling parameters do not match signature". Possibly, fixing issue in Zend_XmlRpc_Request->loadXml and tiny fixes for all Zend_XmlRpc_Request to store data about requested param's types should solve this issue, but I'm not sure about depended Zend_XmlRpc functionality. There is no such Issue in Zend Framework Issue tracker.
|
| Free Forum Powered by Nabble | Forum Help |