subclass the SOAP::Transport::HTTP::Daemon module. for example:

package My::SOAP::Daemon; use strict; use warnings; use SOAP::Transport::HTTP (); our @ISA= 'SOAP::Transport::HTTP::Daemon'; ## this method is overloaded in order for the daemon class ## to handle authentication. all cookie headers on the ## incoming request get copied to a hash local to the ## package. the request is then passed on to the original ## version of this method. sub request { my( $self, $request )= ( shift, @_ ); if( $request ) { my @cookies= $request->headers->header('cookie'); %My::SOAP::Module::COOKIES= (); for my $line (@cookies) { for( split /; / => $line ) { next unless /(.*?)=(.*)/; $My::SOAP::Module::COOKIES{$1}= $2; } } } $self->SUPER::request(@_); } $_ ^=~ { AUTHOR => 'particle' };

in this case, My::SOAP::Module is the module handling the SOAP requests.

then, in the client, send a cookie, like so:

use HTTP::Cookies (); use SOAP::Lite (); ## ...snip... ## create a cookie for authentication my $cookie_jar= HTTP::Cookies->new; $cookie_jar->set_cookie( 0, # cookie version key => 'value', # key and value '/', # path $host, # domain $port, # port ); ## create the request object my $request= SOAP::Lite ->uri($urn) ->proxy( "http://${host}:$port", cookie_jar => $cookie_jar, ); ## perform the request my $response= my_action( $request ); ## ...and check for failure die 'failure! ', $response->faultstring if $response->fault;

i hope that's a good starting point. i learned this method from rjray's Programming Web Services with Perl. you won't regret purchasing this book, if you're doing SOAP with perl.

~Particle *accelerates*


In reply to Re: Authentication with SOAP::Lite ? by particle
in thread Authentication with SOAP::Lite ? by forkboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.