Howdy,
I've worked a lot with Frontier::Daemon, so I'll try to
answer your question. I confess that the way you phrased
your question confuses me, so let me try to rephrase it.
Frontier::Deamon is weird. I'm supposed to pass the
constructor a hash reference whose keys are those of the
XML-RPC Web Service API that I'm trying to implement and whose
values are subroutine references. When XML-RPC clients talk to
this bad boy, how are parameters passed to my subroutines?
If this is your question, it's a good one. Frontier::Daemon is
a subclass of HTTP::Daemon, which is another class whose new() method
doesn't return. When a client connects to a Frontier::Daemon
object, the request XML is parsed into a perl string. This string is
then eval()'ed. The code that does this is in Frontier::RPC2::serve()
and looks like this:
eval { $result = &{ $methods->{$method} }(@{ $call->{'value'} })};
Here, $method is the API name of the requested
method and $call->{'value'} is an array reference that has the
parameters to be passed to the "method." Method is an inaccurate
term here: this isn't an object method call happening here at all. The $methods
hash reference is the hash you passed in at Frontier::Daemon object
instantiation. This may look a little weird if you're not
up on references, but it's really using a code reference to invoke
a subroutine. What's even stranger, perhaps, is that you could
rewrite that line as:
eval{ $methods->{$method}->( @{ $call->{values} } ) };
This, to me, makes it look even more like a method call.
Of course, it's not really.
Now, this may not have been your question.
Is your question more along the lines of:
I've got an HTML form, some of whose values I want
to pass to my Frontier::Daemon object. What kind of form
handler do I need to do this?
A common problem with the name "Web Service" is that it
seems to imply CGI to folks. That's not right (apologies to
Kevin Meanie). The "web" in Web Services refers to the fact
that both web pages and "Web Services" travel across the wire
speaking HTTP.
To get HTML form values to be processed by your Web Service,
you'll need to create a form handler in the language of your
choice (Perl) which unpacks the CGI parameters, packs up the
relevant values into an XML-RPC request, make the request,
extract the response, the paint a new HTML page which does
something with the answer. I wrote a few articles
about XML-RPC
and SOAP for IBM's developerWorks site (under 'web services'),
so have a look there for copious details.
Finally, if your question is:
Man, Frontier::Daemon is really F'ed up! I want my
module to screw with users' heads just like that! Where do
I begin?
To this, I can only say: Screw up your courage and
dive into the source. For bonus points, do look at
DBI.pm and Tk.pm. There be dragons...
Good luck.
|