XMLRPC question

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lelandv
Posts: 1
Joined: Sun Oct 17, 2010 8:47 am

XMLRPC question

Post by lelandv » Wed Oct 20, 2010 5:37 pm

Hi All,

I have an application that I'm trying to prototype that makes extensive use of XMLRPC, including advanced data structures (such as arrays/array-refs, hashes/hashrefs, and even arrays with embedded hashes which themselves may contain additional arrays with further embedded hashes etc.)
I can manage to do just about any manipulation that I need to do for XMLRPC in Perl, but I'm finding the revXMLRPC functions to be very cumbersome with unclear documentation and almost no working examples available that I've been able to find. To be honest, I'm not even sure of the revXMLRPC functions even de-serialise the encapsulated XML data to return standard data structures, or if I then have to use additional functions from revXML to do that.

Perl, of course, contains a number of various libraries to work with XMLRPC and simply deserialises the data to return a data structure with which I can work.

Given that LiveCode/Revolution is toted as "less coding, and more productive", I'm at a loss to find an equivalent to the types of things that I'm trying to do here.

For example, with just a few lines in Perl, I can use (in this example) a couple of XMLRPC calls to obtain a list of virtual machines from a cloud provider, and the current data concerning those machines. (using the Frontier::RPC library for this) .. example:

Code: Select all

# other stuff snipped here to get to the nitty gritty
my %vms ;   #empty hash to store the details of my VMs

# login to rpc server
my $rpc = Frontier::Client->new( url => $server_url );
my $key = $rpc->call('login',$username,$password);

# got my key now start calling various methods...
my $vm_list = $rpc->call('vm.list',$key);

# now iterate the vm.list and get the info for each vm and store it into a local hash for manipulation
foreach my $vm (@{$vm_list}) {
    my $vm_info = $rpc->call('vm_info',$key,$vm->{id});
        # store the data in my %vms hash
    $vms{$vm_info->{id}} = $vm_info ; 
}
$rpc->close();

# now I can do whatever I like with the data... 
# like iterate through the list and display some useful data...

foreach my $vm (keys %vms) {
  print "VM ID:  $vms{$vm}->{id}  --  Hostname:  $vms{$vm}->{hostname}  -- State:  $vms{$vm}->{state}\n";

  # get a list of interfaces in the VM:
  print "Interface List...\n";

  foreach my $if (@{$vms{$vm}->{ifaces}}) {
      print "Interface ID:  $if->{id} -- Speed: $if->{bandwidth} -- Status: $if->{state}\n";
  }
}


I can't seem to find a "reasonable" way to do this in livecode/revolution with the limited examples/documentation that I have available (and I have hard-copies of the RunRev 4.0 user manual, and the 3.0 dictionaries volumes 1 and 2) -- Just wondering if there is a relatively straightforward way of accomplishing the equivalent of the above in livecode as I cannot find any suitable examples after spending hours searching the forums, and the wider net...


Thanks in advance for any pointers, tips, or references that may be useful!

Regards,

L.

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

Re: XMLRPC question

Post by Mark » Sun Nov 14, 2010 12:34 pm

L.,

You provide lots of text but nothing about what you have tried in Revolution so far.

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

Post Reply