XML-RPC???

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dablock
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 23
Joined: Wed Apr 23, 2008 2:51 pm

XML-RPC???

Post by dablock » Fri Aug 14, 2009 3:22 pm

Hello all & TIA for any help.

I'm trying to use Rev's XML-RPC but I'm completely lost. There's little documentation or posts about this. (Alough Sarah's XML stack is excellent!) I've even browsed the revXMLRPC script but still can't put the pieces together. Nor can I find the soap stack mentioned years ago.

All I need is a brief example of connecting to a server & calling a method. Can anyone help?

Thanks again.

dablock
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 23
Joined: Wed Apr 23, 2008 2:51 pm

Post by dablock » Fri Aug 14, 2009 8:39 pm

Finally figured this out so I'll post again in case this may help someone in the future.

In my case I'm accessing the web services for PaperCut, a print auditing software. It requires that you explicitly allow the remote computer access to connect in PaperCut > Options > Config Editor > auth.webservices.allowed-addresses. It also requires a password (auth token) which must be the first parameter passed for any method call. (This setting is located in auth.webservices.auth-token.)

That said, here's an example. My stack contains the following fields with some sample data:

Code: Select all

Host: 192.168.3.125
Port: 9191
Path: rpc/api/xmlrpc
Password: s3p3rs3cr3t
Method: api.isUserExists
Param1: cartman
Result: 
And here's the code:

Code: Select all

on mouseUp
   put revXMLRPC_CreateRequest(field "host",field "port",field "path","http") into rpc_id -- Create the initial connection.
   revXMLRPC_SetMethod rpc_id, fld "method" -- Specify the method to call.
   revXMLRPC_AddParam rpc_id, "string", fld "auth" -- For PaperCut, the first param must be the password.
   revXMLRPC_AddParam rpc_id, "string", fld "param1" -- Second param is the value required by the method.
   put revXMLRPC_Execute(rpc_id) into result_id -- Submit & get the results.
   put revXMLText (result_id) into fld "result"
end mouseUp
This particular method, IsUserExists, simply looks for the user 'cartman' & returns a boolean value.

This is pretty easy now, but I had do a tcpdump to see exactly what was being passed before I could get the syntax just right.

Good luck & thanks to Rev & the community!

Post Reply

Return to “Internet”