SOAP::Transport::HTTP::Apache

SOAP::Transport::HTTP::Apache is a SOAP mod_perl handler.
Download

SOAP::Transport::HTTP::Apache Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Keith Brown
  • Publisher web site:
  • http://search.cpan.org/~kbrown/

SOAP::Transport::HTTP::Apache Tags


SOAP::Transport::HTTP::Apache Description

SOAP::Transport::HTTP::Apache is a SOAP mod_perl handler. SOAP::Transport::HTTP::Apache is a SOAP mod_perl handler.SYNOPSISUse this class to expose SOAP endpoints using Apache and mod_perl. Here's an example of a class that would like to receive SOAP packets. Note that it implements a single interesting function, handle_request, that takes there arguments: an array of headers, a body, and an EnvelopeMaker for creating the response: package Calculator; use strict; sub new { bless {}, shift; } sub handle_request { my ($self, $headers, $body, $envelopeMaker) = @_; $body->{extra_stuff} = "heres some extra stuff"; foreach my $header (@$headers) { $header->{extra_stuff} = "heres some more extra stuff"; $envelopeMaker->add_header(undef, undef, 0, 0, $header); } $envelopeMaker->set_body(undef, 'myresponse', 0, $body); } 1;In order to translate HTTP requests into calls on your Calculator class above, you'll need to write an Apache handler. This is where you'll use the SOAP::Transport::HTTP::Apache class: package ServerDemo; use strict; use SOAP::Transport::HTTP::Apache; sub handler { my $safe_classes = { Calculator => undef, }; SOAP::Transport::HTTP::Apache->handler($safe_classes); }1;As you can see, this class basically does it all - parses the HTTP headers, reads the request, and sends a response. All you have to do is specify the names of classes that are safe to dispatch to.Of course, in order to tell Apache about your handler class above, you'll need to modify httpd.conf. Here's a simple example that shows how to set up an endpoint called "/soap" that maps to your ServerDemo handler above: < Location /soap > SetHandler perl-script PerlHandler ServerDemo < /Location >(I leave it up to you to make sure ServerDemo is in Perl's @INC path - see Writing Apache Modules with Perl and C by O'Reilly for help with mod_perl, or just man mod_perl) Requirements: · Perl


SOAP::Transport::HTTP::Apache Related Software