Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    SOAP::Transport::HTTP::Apache 0.28

    Download button

    No screenshots available
    Downloads: 413  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.5/5)
    15 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Keith Brown | More programs
    Perl Artistic License / FREE
    July 4th, 2008, 15:10 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    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.

    SYNOPSIS

    Use 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)

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    mod_perl handler | Apache class | Perl module | SOAP | mod_perl | handler

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM