Loading ...
Sorry, an error occurred while loading the content.

How do I get the URI in a SOAP::Lite dispatcher?

Expand Messages
  • Scott Ellsworth
    Hi, all, How do I get to the URI in a handler method called from a mod_perl server doing static dispatch to external classes? I have a mod_perl-based SOAP
    Message 1 of 1 , Jan 8, 2004
    • 0 Attachment
      Hi, all,

      How do I get to the URI in a handler method called from a mod_perl
      server doing static dispatch to external classes?

      I have a mod_perl-based SOAP server that calls some of my methods in a
      few classes using SOAP::Lite 0.55. It is working well, at least for
      SOAP callers calling from Perl. Unfortunately, every call requires the
      user to send in a config_name parameter to tell it database passwords
      and the like. Since the config_name is determined entirely by the URI,
      I want to remove it. (Example: feature.alodar.com has the config_name
      'feature', while client.foobar.com has the config_name 'client'.)

      The problem? I cannot figure out how to get the URI in my handler
      method.

      This is mod_perl based, and so in my httpd.conf, I have:
      <Location /gbib-soap>
      SetHandler perl-script
      PerlHandler Alodar::GBIB::SOAPUtils
      </Location>

      Here is the complete Alodar::GBIB::SOAPUtils implementation.

      package Alodar::GBIB::SOAPUtils;

      require Exporter;

      use strict;
      use SOAP::Transport::HTTP;

      our @ISA = qw(Exporter);

      our @EXPORT_OK = qw(
      handler
      );

      sub handler {
      SOAP::Transport::HTTP::Apache -> dispatch_to(
      qw(
      Alodar::GBIB::ListUtils::get_public_lists
      Alodar::GBIB::UserUtils::get_user_ids_by_name
      )
      ) ->handler(@_)
      }

      1;

      This works just great.

      Once the config name is tweedled, the handler would then look something
      like:

      sub handler {
      my $hostname = something from the uri
      my $uri = something from the uri
      my %args = (
      config_name => get_configname_from_url(hostname => $hostname,
      uri => $uri)
      @_, # push key-value pairs into args
      );

      SOAP::Transport::HTTP::Apache -> dispatch_to(
      qw(
      Alodar::GBIB::ListUtils::get_public_lists
      Alodar::GBIB::UserUtils::get_user_ids_by_name
      )
      ) ->handler(%args)
      }

      The problem? I cannot figure out how to get the URI at this point. Is
      it available? (Help that includes the proper perldoc to have figured
      it out myself greatly appreciated - I am still learning this.)

      Scott
    Your message has been successfully submitted and would be delivered to recipients shortly.