[phpxmlrpc] byte[] to PHP-string conversion RESOLVED
Gaetano Giunta
giunta.gaetano at gmail.com
Thu Jul 17 23:08:44 BST 2008
Marcel Ruff a écrit :
> Hi again,
>
> changing the code to
>
> $res = php_xmlrpc_decode( $result->value() );
>
> // instead of
> // $res = xmlrpc_decode( $result->serialize() );
>
> resolved it (i have not investigated further to understand it),
The function xmlrpc_decode is from the php xmlrpc extension
The function php_xmlrpc_decode is from the phpxmlrpc library
Both server the same purpose, ie creating xmlrpc servers and clients in
php, but they should generally not be mixed up. As a general guideline,
the extension is much faster, but the library is more complete.
Bye
Gaetano
>
> regards
> Marcel
>
>
> Marcel Ruff wrote:
>> Hi,
>>
>> i have a Java xmlrpc server which returns an array of triples
>> {
>> String key
>> byte[] content
>> String qos
>> }
>>
>> When i call it with phpxmlrpc i get:
>>
>> <methodResponse>
>> <params>
>> <param>
>> <value>
>> <array>
>> <data>
>> <value>
>> <array>
>> <data>
>> <value><string>Hello</string></value>
>> <value><base64>MzQz</base64></value>
>> <value><string><qos/></string></value>
>> </data>
>> </array>
>> </value>
>> </data>
>> </array>
>> </value>
>> </param>
>> </params>
>> </methodResponse>
>>
>> Now my problem:
>>
>> I can read in PHP the two strings without problem
>> but how can i read the binary data (encoded with base64)?
>>
>> $result = $this->client->send( $rpcmsg );
>> $res_array = xmlrpc_decode( $result->serialize() );
>> $messages = array( count($res_array) ) ;
>> $cpt = 0 ;
>> foreach( $res_array as $r ){
>> dbgprint( "OK: [$r[0]]" );
>> // $r[1] from <value><base64>MTg4Mw==</base64></value>
>> // THIS FAILS:
>> dbgprint( "binary data: $r[1]" );
>> }
>>
>> Error thrown:
>> ----> Object of class stdClass could not be converted to string in ...
>>
>> But $r[1] should contain the text "Hi".
>>
>> What am i missing?
>>
>> Thanks
>> Marcel
>>
>>
>> _______________________________________________
>> phpxmlrpc mailing list
>> phpxmlrpc at lists.usefulinc.com
>> http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
>>
>
> _______________________________________________
> phpxmlrpc mailing list
> phpxmlrpc at lists.usefulinc.com
> http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
>
More information about the phpxmlrpc
mailing list