XMLRPC question
Hi All, Apologies in advance if something along these lines has already been raised on the mailing list having just joined the list at the suggestion of runrev support. I did try via the forums and looking around the wider net for some information, but have drawn blanks. Please see below the cruxt of the question/problem that I posted to the forums. Thanks in advance for any guidance, advice, pointers, etc. Regards, Leland -- From the forums: 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 --- # 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; } } --- end code --- 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. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: XMLRPC question
Welcome to the list, Leland. I don't know the exact differences, but Key Ray has created an alternative library for XML in Revolution - many users say it's a better implementation. http://www.sonsothunder.com/products/xmllib/xmllib.htm sqb On 21 October 2010 09:29, Leland Vandervort lel...@dev.discpro.org wrote: Hi All, Apologies in advance if something along these lines has already been raised on the mailing list ‹ having just joined the list at the suggestion of runrev support. I did try via the forums and looking around the wider net for some information, but have drawn blanks. Please see below the cruxt of the question/problem that I posted to the forums. Thanks in advance for any guidance, advice, pointers, etc. Regards, Leland -- From the forums: 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 --- # 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; } } --- end code --- 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. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution -- Stephen Barncard San Francisco Ca. USA more about sqb http://www.google.com/profiles/sbarncar ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: XMLRPC question
Glad to see you here, Leland. I hope somebody will address this, since I sent you here. :) Come on guys, I bragged about you. On 10/21/10 11:29 AM, Leland Vandervort wrote: Hi All, Apologies in advance if something along these lines has already been raised on the mailing list ‹ having just joined the list at the suggestion of runrev support. I did try via the forums and looking around the wider net for some information, but have drawn blanks. Please see below the cruxt of the question/problem that I posted to the forums. Thanks in advance for any guidance, advice, pointers, etc. Regards, Leland -- From the forums: 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 --- # 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; } } --- end code --- 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. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: XMLRPC question
Hello There Leland, Be welcome. Are you calling Userland Frontier server with that XML-RPC code? Well, let my curiosity be put aside and let us get back to business. Our XML-RPC library is barebones, it works but it is basically some convenient methods wrapping our XML generation library. Mind you that some time ago, LiveCode (then known as Revolution) had no multidimensional arrays, so building structs and more complex objects was not trivial since we could not match them to some of our data types. Now LiveCode has multidimensional arrays which are not actually arrays but hash tables. So we could map back and forth complex structs/arrays with ease but no one bothered to write those routines. I bet people here have their own home cooked solution. I built in dozens of lines a routine to pick an array (LiveCode one) and build a struct out of it. Works well and is used internally for testing on the company I work for. I haven't build the reverse routine to pick from XML-RPC response and decode it back to something addressable. Mind you that building that routine is not actually difficult, it is just tedious and error prone but it is simple. These days I am somewhat busy but as soon as I have free time, I will address this problem. In the mean while, I suggest that you use a combination of XML-RPC and XML routines to extract your data. You can make it generic enough so that you can feed it any XML-RPC response and get an array back, the trick is the iteration routine to recursively extract arrays and structs from inside arrays and structs. So making a summary, right now, you don't have fancy routines for making an XML-RPC a nice object if the response contains complex structures but you have helper XML and XML-RPC methods that make building such function an approachable task that can be finished in couple hours. sorry for not being more helpful right now. andre PS: I am somewhat disornganized with my projects, there might be the case that I've built this function in the past and forgot about it. Will check out. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: XMLRPC question
Leland- Welcome to the list. In addition to what Andre's already posted, It's certainly possible in perl to create some densely terse routines, so I think the claim of less coding is quite relative, and depends somewhat on what libraries you already have available to you. From your perl snippets it looks like you're dealing with web services on a remote server. In that case the library I put on revOnline may be of some help to you: libSOAP. I've tried to encapsulate some of the complexities of dealing with XMLRPC in an easy (easier) to use and more rev^H^H^Hlivecode-friendly format. Your phrase relatively straightforward again is in the eye of the beholder, but hopefully this may give you something to start with. -- -Mark Wieder mwie...@ahsoftware.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: XMLRPC question
So THAT'S why I can't figure them out! I quit smoking hash a long time ago! And do they really make tables specifically for smoking hash?? Something's not right. It may be me. Bob On Oct 21, 2010, at 2:39 PM, Andre Garzia wrote: Now LiveCode has multidimensional arrays which are not actually arrays but hash tables. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: XMLRPC question
Hi Andre, Nah.. Frontier is one of the [XML]RPC libraries available for perl in CPAN. For client side applications it's much simpler to use than the standard RPC::XML::Client library because it handles the mapping of the data structures back into hashrefs and dynamically types them, whereas the standard RPC::XML::Client needs a bit more wrap around it to do effective typing (bool, int, string, etc.) and hashref mapping. I don't use Frontier for server-side though because it doesn't serialise correctly for the complex recursive/embedded data structures that I often need -- for server side I use RPC::XML::Server. As for multidimensional arrays (hashes), all I can say is WIN WIN WIN. I use these extensively in Perl, C# (under the guise of Dictionary, or simply multiple declared structures) and C++/Qt (under the guise of QmapQvariant,..). I'm still trying to get to grips with Rev/LiveCode since as you can probably tell, being used to object-oriented algorithmic languages (Perl, C++, C#, etc) it's a completely different mindset when moving to a very high level, almost natural, language... As Yoda said .. you must unlearn what you have learned... Fine for a 900 year old muppet ... LOL My primary use of Rev/LiveCode is prototyping, especially for cross platform, but if it's something that in the end is robust, quick, and still cross-platform, then I can simply deploy with Rev and be done with it :) (Plus, I am interested in the mobile application deployment options as well...) Regards, Leland Le 21/10/2010 23:39, « Andre Garzia » an...@andregarzia.com a écrit : Hello There Leland, Be welcome. Are you calling Userland Frontier server with that XML-RPC code? Well, let my curiosity be put aside and let us get back to business. Our XML-RPC library is barebones, it works but it is basically some convenient methods wrapping our XML generation library. Mind you that some time ago, LiveCode (then known as Revolution) had no multidimensional arrays, so building structs and more complex objects was not trivial since we could not match them to some of our data types. Now LiveCode has multidimensional arrays which are not actually arrays but hash tables. So we could map back and forth complex structs/arrays with ease but no one bothered to write those routines. I bet people here have their own home cooked solution. I built in dozens of lines a routine to pick an array (LiveCode one) and build a struct out of it. Works well and is used internally for testing on the company I work for. I haven't build the reverse routine to pick from XML-RPC response and decode it back to something addressable. Mind you that building that routine is not actually difficult, it is just tedious and error prone but it is simple. These days I am somewhat busy but as soon as I have free time, I will address this problem. In the mean while, I suggest that you use a combination of XML-RPC and XML routines to extract your data. You can make it generic enough so that you can feed it any XML-RPC response and get an array back, the trick is the iteration routine to recursively extract arrays and structs from inside arrays and structs. So making a summary, right now, you don't have fancy routines for making an XML-RPC a nice object if the response contains complex structures but you have helper XML and XML-RPC methods that make building such function an approachable task that can be finished in couple hours. sorry for not being more helpful right now. andre PS: I am somewhat disornganized with my projects, there might be the case that I've built this function in the past and forgot about it. Will check out. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: XMLRPC question
Hi Mark, Thanks for the tip. Will check out your libSOAP, though there are some small (but majorly significant) differences between SOAP and pure XMLRPC, especially for the service that I'm trying to prototype for. (basically a client to control, provision, and monitor virtual server resources that one has with a certain cloud VPS provider). I would just bite the bullet and do it all in C++/Qt, but that takes quite a bit of time, and for it to be truly cross-platform, I have to build it on three separate platforms with modifications to the headers, paths, and makefiles each time, which makes it somewhat cumbersome. (Been down that route before when I did an app for our support team that had to run on Linux, Windows and Mac... -- actually that's the reason I bought the Mac in the first place, and since I did I've been using it as my primary workstation ever since, though I still extensively also use Linux, and windows to a lesser extent -- vendor agnostic style !) Regards, Leland Le 21/10/2010 23:50, « Mark Wieder » mwie...@ahsoftware.net a écrit : Leland- Welcome to the list. In addition to what Andre's already posted, It's certainly possible in perl to create some densely terse routines, so I think the claim of less coding is quite relative, and depends somewhat on what libraries you already have available to you. From your perl snippets it looks like you're dealing with web services on a remote server. In that case the library I put on revOnline may be of some help to you: libSOAP. I've tried to encapsulate some of the complexities of dealing with XMLRPC in an easy (easier) to use and more rev^H^H^Hlivecode-friendly format. Your phrase relatively straightforward again is in the eye of the beholder, but hopefully this may give you something to start with. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: XMLRPC question
I seem to be having memory flashbacks to one time at a coffee shop (no coffee present) in Dam square in Amsterdam... Hmmm... ;-) L. Le 21/10/2010 23:56, « Bob Sneidar » b...@twft.com a écrit : So THAT'S why I can't figure them out! I quit smoking hash a long time ago! And do they really make tables specifically for smoking hash?? Something's not right. It may be me. Bob On Oct 21, 2010, at 2:39 PM, Andre Garzia wrote: Now LiveCode has multidimensional arrays which are not actually arrays but hash tables. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution