Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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('http://www.example.com/Protected') -> proxy('http://www.example.com/soap.cgi') -> 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.


Comment on Re: Authentication and Authorization for SOAP
Select or Download Code
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2015-07-06 17:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls