git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_SGD/tags/3.7.0.2_original@1 eb19766c-00d9-a042-a3a0-45cb8ec72764
53 lines
1.3 KiB
Perl
53 lines
1.3 KiB
Perl
#!/usr/local/bin/perl
|
|
|
|
use Frontier::Client;
|
|
|
|
my $serverURL='http://phpxmlrpc.sourceforge.net/server.php';
|
|
|
|
# try the simplest example
|
|
|
|
my $client = Frontier::Client->new( 'url' => $serverURL,
|
|
'debug' => 0, 'encoding' => 'iso-8859-1' );
|
|
my $resp = $client->call("examples.getStateName", 32);
|
|
|
|
print "Got '${resp}'\n";
|
|
|
|
# now send a mail to nobody in particular
|
|
|
|
$resp = $client->call("mail.send", ("edd", "Test",
|
|
"Bonjour. Je m'appelle Gérard. Mañana. ", "freddy", "", "",
|
|
'text/plain; charset="iso-8859-1"'));
|
|
|
|
if ($resp->value()) {
|
|
print "Mail sent OK.\n";
|
|
} else {
|
|
print "Error sending mail.\n";
|
|
}
|
|
|
|
# test echoing of characters works fine
|
|
|
|
$resp = $client->call("examples.echo", 'Three "blind" mice - ' .
|
|
"See 'how' they run");
|
|
print $resp . "\n";
|
|
|
|
# test name and age example. this exercises structs and arrays
|
|
|
|
$resp = $client->call("examples.sortByAge",
|
|
[ { 'name' => 'Dave', 'age' => 35},
|
|
{ 'name' => 'Edd', 'age' => 45 },
|
|
{ 'name' => 'Fred', 'age' => 23 },
|
|
{ 'name' => 'Barney', 'age' => 36 } ] );
|
|
|
|
my $e;
|
|
foreach $e (@$resp) {
|
|
print $$e{'name'} . ", " . $$e{'age'} . "\n";
|
|
}
|
|
|
|
# test base64
|
|
|
|
$resp = $client->call("examples.decode64",
|
|
$client->base64("TWFyeSBoYWQgYSBsaXR0bGUgbGFtYiBTaGUgd" .
|
|
"GllZCBpdCB0byBhIHB5bG9u"));
|
|
|
|
print $resp . "\n";
|