[ale] Implementing XML-RPC

Christopher Fowler cfowler at outpostsentinel.com
Fri Feb 11 08:57:27 EST 2005


Thanks for all your help.  I happened to have the O'Reilly book but it
was hidden by other books on my shelf.  Late last night I found it.  It
is brief but is providing me some answers.  I've been able to create
some code on our device from scratch that is working great with the
Frontier client.  I've not done the XML parsing on the device or created
any methods but I'm working on that today and next week.


Has anyone used the Frontier client?

--- Test Code ---
use Frontier::Client;
$server = Frontier::Client->new( debug => 1, url =>
'https://192.168.2.120/cgi-bin/xml-rpc' );
$result = $server->call('restart', ("now"));
print "$result\n";
--- Test Code ---

Here is the problem.  It works fine when the code is in stand alone
debug mode.  But I'm not doing any authentication. Instead of using
a string as the 'url' in the contstructor I need to use LWP to login to
the site to get a valid cookie.  If I place this code in the production
site without a valid cookie I'll simply be redirected to
'/cgi-bin/login' .  I'm not really planning on using Frontier for
production code.  The PERL in this case is all test code.  J2EE will be
doing the interfacing with the remote device.  I'll eventually create a
device object in Perl that will use XML-RPC to execute remote commands
but that is not important now.  I'm just curious as to how I can use
Frontier with my device since all pages on my device require form based
authentication.

Thanks,
Chris

  
On Fri, 2005-02-11 at 08:13, Fletch wrote:
> >>>>> "Christopher" == Christopher Fowler <cfowler at outpostsentinel.com> writes:
> 
> [...]
> 
>     Christopher> I think that is right.  I can not seem to find info
>     Christopher> on how to return errors.  Simply like what XML do I
>     Christopher> return if for example a method is called that does
>     Christopher> not exist on the server?
> 
> I can't recall offhand (I want to say it's something like
> <error><code>#</code><message>...</message></error>), but if you
> install the Perl RPC::XML module (or use the Python one which is stock
> post 2.3 I think, or the Ruby one that's stock post 1.8.2 :) and send
> a simple server a bogus request you should be able to see what those
> send back.



More information about the Ale mailing list