Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Authentication and Authorization for SOAP

by Ieronim (Friar)
on Jul 14, 2006 at 17:17 UTC ( #561275=note: print w/replies, xml ) Need Help??

in reply to Authentication and Authorization for SOAP

You can pass the username and password as parameters in your request, like
my $result = SOAP::Lite -> uri('') -> proxy('') -> fetchdata($name, $pass, @request) -> result;
And define the fetchdata method at server-side as smth like this (i didn't add SOAP-specific code, but it can be taken directly from SOAP::Lite docs):
package Protected; sub fetchdata { my $pkg = shift; my $name = shift; my $pass = shift; #check the $name and $pass and process @request # or send an response indicating authentication error }

I have no experience in Java, but as i can see, the code sample you showed seems to do the same thing, but sends only name and password.

Replies are listed 'Best First'.
Re^2: Authentication and Authorization for SOAP
by rob_au (Abbot) on Jul 14, 2006 at 17:32 UTC
Re^2: Authentication and Authorization for SOAP
by duckyd (Hermit) on Jul 14, 2006 at 20:37 UTC
    A common practice is to pass authentication information in the SOAP headers. With SOAP::Lite, you can do this by creating SOAP::Header objects (just like SOAP::Data, but they'll be placed in the header):
    my $headers = SOAP::Header ->name( 'LoginCredentials' ) ->value( [ SOAP::Header ->name('Username') ->value( $username ) , SOAP::Header ->name('Password') ->value( $password ) , ] ) ) ;
    The login credentials can then be passed along with any other arguments into whatever SOAP method is being called, and dealt with seperately.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://561275]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2016-10-23 00:26 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (299 votes). Check out past polls.