Let's see if I get it straight...

> 
> Hi there,
> 
> Unfortunately I have a problem with the client lib "xmlrpc.inc":
> 
> In the Documentation http://xmlrpc.usefulinc.com/doc/xmlrpcval.html
> I read:
> The elements of the array must be xmlrpcval objects themselves.
> 
> Now, I do a request via $client->send,
> the serialized form looks like this:
> <methodResponse> <params> <param> <value><struct> =
> <member><name>displayName</name> <value><string>/</string></value> =
> </member> <member><name>dataType</name> =
> <value><string>resource</string></value> </member> =
> <member><name>size</name> <value><int>0</int></value> </member> =
> <member><name>parentUri</name> <value><string>/</string></value> =
> </member> <member><name>uri</name> <value><string>/</string></value> =
> </member> <member><name>folder</name> =
> <value><boolean>1</boolean></value> </member> 
> <member><name>id</name> =
> <value><string>/</string></value> </member> </struct></value> 
> </param> =
> </params> </methodResponse> 
> 
> The response contains an xmlrpcval whos value is an associative array,
> but the values of that array are NOT xmlrpcval objects but
> string/boolean/int. 
> 
> $response=$client->send(...);

(Quoted text is taken from the docs)

$response is "an instance of xmlrpcresp"

> $value=$response->value();

$value is "an xmlrpcval object containing the return value sent by the server"
Given the above xml snippet, I'd suspect it's type is "struct". To check it out:
$kind=$value->kindOf();
echo "VALUE IS OF KIND : $kind";

> $rpcval=$value->getval();

Here's the magic part: $rpcval is a PHP array!!!

It happens because the getval() function serves exactly this purpose: get rid of all 
xml-rpc objects cruft and easily transform xml-rpc objects into native php data types. 
Saves you lottsa coding on large nested arrays/structs.

I know it's not documented in the official docs, you have to look for it in the 
changelog.

If you just wanted to get the xmlrpc-objects out of your struct, you should have used:
list($key,$ value) = $value->structeach();

> gettype($rpcval['uri']) is string and not Object of xmlrpcval!!!
> 
> THIS DOES NOT APPLY TO THE DOCUMENTATION.
> 

False! (see above)
Plus you'r using an undocumented function...

For the rest of the original post, see if it still applies after reading the above and 
in case ask again :)

Ciao
Gaetano



_______________________________________________
phpxmlrpc mailing list
[EMAIL PROTECTED]
http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc

Reply via email to