Oh Wise Monks,
I have given up trying to write a SOAP server. Instead, I need to write an XML-RPC Listener. So I have installed Frontier-RPC and started playing with the examples.
I got server a working with Frontier::Daemon no problem. I use this script to test it ...
#!/usr/bin/perl
# Testing sum()
use strict;
use warnings;
use Frontier::Client;
my $url = "http://localhost:8181/RPC2";
my @args = (2,5);
my $client = Frontier::Client->new( url => $url, debug => 1 );
print "$args[0] + $args[1] = ", $client->call('sum', @args), "\n";
... here's the output to that shows my daemon server works:
$ ./fcclient.pl
---- request ----
<?xml version="1.0"?>
<methodCall>
<methodName>sum</methodName>
<params>
<param><value><i4>2</i4></value></param>
<param><value><i4>5</i4></value></param>
</params>
</methodCall>
---- response ----
<?xml version="1.0"?>
<methodResponse>
<params>
<param><value><string>7</string></value></param>
</params>
</methodResponse>
2 + 5 = 7
... but I also want to use Frontier::Responder so I can respond to request for normal CGI processes. So I put the script in my webserver's cgi-bin dir ...
plankton@ubuntu:/usr/lib/cgi-bin$ cat fcresponder.cgi
#!/usr/bin/perl -w
use strict;
use Frontier::Responder;
use CGI;
my $cgi = new CGI;
my $xml = $cgi->param('POSTDATA');
my $res = Frontier::Responder->new( methods => {
sum => sub{ $_[0] + $
+_[1] },
add => sub{ $_[0] + $
+_[1] },
cat => sub{ $_[0] . $
+_[1] },
},
);
print $res->answer;
... and then I change my test script to this ...
plankton@ubuntu:/usr/lib/cgi-bin$ cat test_fcresonder.cgi
#!/usr/bin/perl -w
use strict;
use Frontier::Client;
my $server = Frontier::Client->new(url => "http://localhost/cgi-bin/fc
+responder.cgi", debug => 1);
my $method = 'sum';
my @args = (1,1);
my $result = $server->call($method, @args);
print "$result\n";
... and when I run the above I get this output ...
plankton@ubuntu:/usr/lib/cgi-bin$ ./test_fcresonder.cgi
---- request ----
<?xml version="1.0"?>
<methodCall>
<methodName>sum</methodName>
<params>
<param><value><i4>1</i4></value></param>
<param><value><i4>1</i4></value></param>
</params>
</methodCall>
---- response ----
no element found at line 1, column 0, byte -1 at /usr/lib/perl5/XML/Pa
+rser.pm line 187
... what am I doing wrong?