From: Jamie C. <jca...@we...> - 2002-03-27 05:26:24
|
Wil Cooley wrote: > > Also Sprach Jamie Cameron <jca...@we...> on Mon, Mar 18, 2002 at 05:39:14PM PST > > The need for extra modules is part of the reason for not using XML-RPC, > > but another is that (as far as I know) it doesn't support the passing > > of complex structures as parameters or return values. Because many of > > the remote webmin functions pass or return arrays and hashes, the lack > > of structures really rules out XML-RPC, which only supports simple > > types like strings and numbers. > > > > Correct me if I am wrong about this though, because it probably wouldn't > > be too hard to add some kind of gateway between XML-RPC and Webmin RPC > > if they both have the same capabilities .. > > I've been thinking more about this, and the complex > datastructures should pose no problem. I did a little > looking around my Perl installation (including CPAN modules > RH shipped) and found XML::Dumper, which will take a Perl > structure and output XML. Here's an example from the man > page: > > #!/usr/bin/perl > > # Convert Perl code to XML > use XML::Dumper; > my $dump = new XML::Dumper; > $data = [ > { > first => 'Jonathan', > last => 'Eisenzopf', > email => 'ei...@po...' > }, > { > first => 'Larry', > last => 'Wall', > email => ' la...@wa...' > } > ]; > $xml = $dump->pl2xml($data); > > print $xml, "\n" ; > > # EOF > > Which produces: > > <perldata> > <array> > <item key="0"> > <hash> > <item key="last">Eisenzopf</item> > <item key="first">Jonathan</item> > <item key="email">ei...@po...</item> > </hash> > </item> > <item key="1"> > <hash> > <item key="last">Wall</item> > <item key="first">Larry</item> > <item key="email"> la...@wa...</item> > </hash> > </item> > </array> > </perldata> > > Violá! That's a good solution .. as long as callers are willing to convert all structures into this format, then I can't see any problems with it. What someone needs to do is write a gateway of some kind between webmin-RPC and XML-RPC .. or even add XML-RPC support directly to webmin. I wouldn't want to get rid of the existing RPC right away, in order to preserve backwards compatibility, but there is no reason why they both cannot exist side-by-side. What kind of network transport does XML-RPC use? Does it make an HTTP connection for each function call, or use some other special protocol? - Jamie |