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

Re: [soaplite] Accessing HTTP Auth from a SOAP service

Expand Messages
  • paul.hampson@pobox.com
    ... After futzing around, here s a public record of how I get the headers at the server end, and how I do em in the client. (Non-autodispatch, since I m on
    Message 1 of 8 , May 5, 2005
      On Thu, May 05, 2005 at 11:57:08AM -0500, Jay A. Kreibich wrote:
      > On Thu, May 05, 2005 at 01:22:39PM +1000, paul.hampson@... scratched on the wall:
      > > On Tue, May 03, 2005 at 11:12:12PM -0500, Jay A. Kreibich wrote:
      > > > On Mon, May 02, 2005 at 01:41:13PM -0000, Paul TBBle Hampson scratched on the wall:
      > > > > I'm creating a SOAP service which I want to
      > > > > username/password protect, against the database
      > > > > the service modifies.
      > > > I would suggest you look at SOAP Headers, rather than HTTP headers.
      > >
      > > OK, fair point and well taken.
      > >
      > > I've found the '@ISA' thing that lets me pop the SOM out of @_ at the
      > > start of every function, so I'm guessing I just call ->headers on that,
      > > and skip happily through that array until I find the custom headers
      > > I've defined...
      > I though that returned a hash ref, not an array, but you've got the right
      > idea. This is exactly what I'm doing with a large SOAP interface I'm
      > building to front-end a database we run.

      After futzing around, here's a public record of how I get the headers
      at the server end, and how I do 'em in the client.
      (Non-autodispatch, since I'm on perl 5.8.4 and couldn't find the
      workaround again, after seeing it once.)

      sub showenv {
      my $som = pop;
      my $returnlist;
      $returnlist = "Username: ". $som->match(SOAP::SOM::header."/login")->valueof. "; password: ".$som->match(SOAP::SOM::header."/password")->valueof. ";";
      chomp $returnlist;
      return $returnlist;

      Client: (This was the easy part. ^_^)
      my $soapuser = SOAP::Header->new(name => 'login', value => 'user');
      my $soappass = SOAP::Header->new(name => 'password', value => 'pass');
      my $result = $soap->showenv($soapuser, $soappass);

      This was arrived at largely thanks to a blog posting in the howto
      link on the soaplite homepage about "forwarding headers" along with
      a liberal application of Data::Dumper::Simple. ^_^

      Paul "TBBle" Hampson, on an alternate email client.
    Your message has been successfully submitted and would be delivered to recipients shortly.