RevXMLRPC-problem

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
rutger
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3
Joined: Sun Nov 14, 2010 4:05 pm

RevXMLRPC-problem

Post by rutger » Sun Nov 14, 2010 4:19 pm

Hello all,

I suppose this is a very basic question, however, I can't seem to get the XMLRPC library to work. The thing is, I want to create a connection to my server (which uses a ZEND XMLRPC-server to answer) with XMLRPC but the server doesn't recognize my parameters. A sample with a Zend XMLRPC Client, which uses as parameter "Rutger" will deliver the following answer:

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse><params><param><value><string>Uw waarde: Rutger</string></value></param></params></methodResponse>

I try to get the same response from a small LiveCode-application:

on mouseUp
local host, portRPC, path, method, rpc_id
put "www.pers-e.nl" into host
put "80" into portRPC
put "nutest/xmlrpcserver.php" into path
put "echoValue" into method

put revXMLRPC_CreateRequest(host,portRPC,path,"http") into rpc_id -- Create the initial connection.
revXMLRPC_SetMethod rpc_id, method -- Specify the method to call.
revXMLRPC_AddParam rpc_id, "string", "Rutger"

   put revXMLRPC_Execute(rpc_id) into result_id -- Submit & get the results.
   put revXMLText (result_id) into fld "antwoord"

end mouseUp

Which gives me the following answer:

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse><fault><value><struct><member><name>faultCode</name><value><int>623</int></value></member><member><name>faultString</name><value><string>Calling parameters do not match signature</string></value></member></struct></value></fault></methodResponse>

Trying to give the parameters via xml brings me just a small stap further:

on mouseUp
local host, portRPC, path, method, rpc_id
put "www.pers-e.nl" into host
put "80" into portRPC
put "nutest/xmlrpcserver.php" into path
put "echoValue" into method

put revXMLRPC_CreateRequest(host,portRPC,path,"http") into rpc_id -- Create the initial connection.
   revXMLRPC_SetMethod rpc_id, method -- Specify the method to call.
put "<struct>"&\
"<params>"&\
"<param>"&\
"<value>"&\
"<string>Rutger</string>"&\
"</value>"&\
"</param>"&\
"</params>"&\
"</struct>" into theStruct
revXMLRPC_AddParam rpc_id, "xml", theStruct
put revXMLRPC_Execute(rpc_id) into result_id -- Submit & get the results.
put revXMLText (result_id) into fld "antwoord"
end mouseUp

This gives me:
<?xml version="1.0" encoding="UTF-8"?>
<methodResponse><params><param><value><string>Uw waarde: </string></value></param></params></methodResponse>


So, no mention of the input-parameter "Rutger".

What on earth am I doing wrong?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: RevXMLRPC-problem

Post by Mark » Sun Nov 14, 2010 9:58 pm

Hi Rutger,

Are you Dutch? You might ask your question at http://runrev.info/rrforum/

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

rutger
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3
Joined: Sun Nov 14, 2010 4:05 pm

Re: RevXMLRPC-problem

Post by rutger » Sun Nov 14, 2010 10:21 pm

Finally found the error. Not in the Rev-functions, but in the Zend-example :$
Apparently I forgot to add the param tags which tell Zend what type the values should have. The Zend-client in php worked without a problem, but both LiveCode and Flex (my second try) didn't.

Mark: Yes, I am dutch. Didn't know there are that many dutchmen using LiveCode ;)

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: RevXMLRPC-problem

Post by mwieder » Sun Nov 14, 2010 10:57 pm

Rutger-

Glad it's working now. You don't mention what platform you're working with, but for troubleshooting network stuff like this you might look at WireShark or ngrep for sniffing the network traffic, *especially* if you have a working example already.

...and I'm not sure XMLRPC counts as a "beginners" topic... <g>

rutger
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 3
Joined: Sun Nov 14, 2010 4:05 pm

Re: RevXMLRPC-problem

Post by rutger » Sun Nov 14, 2010 11:57 pm

I'm working on os x and was mainly attracted to LiveCode because of the iPad output. Xmlrpc seemed like a nice topic to try for me as I am more versed in php and web apps and am planning on making apps that should sync with a server. But I am still very new to LiveCode, which uses à very diferent coding grammar, so I thought I made a stupid mistake somewhere. I have to say coding actionscript comes easier to me.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: RevXMLRPC-problem

Post by mwieder » Mon Nov 15, 2010 2:50 am

<g again>

Yeah, actionscript and livecode programming are pretty different things.

But the way I debug xmlrpc stuff is the same with either: launch WireShark and log the network traffic to the server while a known good transaction is taking place, then do the same with my attempt, and note the differences. Usually there'll be something really obvious: a bad authentication header, a missed parameter, etc.

Post Reply