[ale] Semi OT - PHP question

James Sumners james.sumners at gmail.com
Sun Feb 19 10:14:07 EST 2006


My guess would be that you are not sending the XML RPC server XML
formed the way it wants. Try adding this line
`print('<pre>');print_r($msg);print('</pre>');` before your "$response
=" line, comment out the rest of the script, and then view the page.
You should see the XML that the XML_RPC class has built and is going
to send to your XML RPC server. The XML you have included in your
email is coming from the server, not your client (as far as I can
tell).

On 2/19/06, Jim <ale_nospam at fayettedigital.com> wrote:
> I'm venturing into php, specifically xmlrpc and wrote what I thought was
> going to be the simplest client possible, but what it is telling me
> makes no sense.
>
> Here's the code.
>
> <?php
> include ('XML/RPC.php');
>
>
> $client = new XML_RPC_CLIENT("/RPC2","localhost",8181);
> $client->setDebug(1);
> $str = new XML_RPC_Value("Test String ", "string");
> $msg = new XML_RPC_Message("local.echo",$str);
> $response = $client->send($msg);
> if (!$response->faultCode()) {
>     $value = $response->value();
>     echo $value;
> } else {
>     print "Error code: " . $response->faultCode() . " Message: " .
> $response->faultString() . "\n";
>     }
>
> ?>
> And here is the error output.  "missing top level xmlrpc element"???
> Sure looks like <methodResponse> to me.
>
> And another thing, the message "Test message" is supposed to come back
> with the Echo statement but it isn't.  If I run the equivalent perl
> code, it works fine, so I'm pretty sure the server is working OK.
>
> Any ideas?
>
>
> ---GOT---
> HTTP/1.1 200 OK
> Date: Sun, 19 Feb 2006 11:24:44 GMT
> Server: libwww-perl-daemon/1.36
> Content-Length: 130
> Content-Type: text/xml
>
> <?xml version="1.0"?>
> <methodResponse>
> <params>
> <param><value><string>Echo: </string></value></param>
> </params>
> </methodResponse>
>
> ---END---
>
> ---PARSED---
> NULL
> ---END---
>
> Error code: 2 Message: Invalid return payload: enabling debugging to
> examine incoming payload missing top level xmlrpc element
>
> Thanks,
> Jim.
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>


--
James Sumners
http://james.roomfullofmirrors.com/

"All governments suffer a recurring problem: Power attracts
pathological personalities. It is not that power corrupts but that it
is magnetic to the corruptible. Such people have a tendency to become
drunk on violence, a condition to which they are quickly addicted."

Missionaria Protectiva, Text QIV (decto)
CH:D 59



More information about the Ale mailing list