in reply to Re^2: Basic authentication in SOAP
in thread Basic authentication in SOAP

Where it says 'username', put in the username to login as. Replace 'password' with the appropriate password for the username you're trying to use.

SOAP::Transport will call this function to get the username and password to log in as, so when you override the function, it'll log in with what you tell it.

Replies are listed 'Best First'.
Re^4: Basic authentication in SOAP
by mrguy123 (Hermit) on Jul 20, 2006 at 13:16 UTC
    Thanks. I have done what you said. However, I would expect to see something like this in the header when I send my request:
    POST http://newscentre.aap.com.au/SRW/SRW.asmx Authorization: Basic dmljcGFybDJcbWV0YWxpYjo1bmV3c2NlbnRyZTM=
    . Since this is not in the header (or anywher else in the SOAP request), I think that I am missing something. Are you sure this is all that needs to be done?

      You'd think so, but you'd be wrong -- HTTP basic authentication is normally a two pass process -- once for the client to find it needs authentication, and a second request when it actually sends the authentication. In HTTP, a server might have multiple realms associated with it, and the client has no way of knowing which realm it needs to authenticate under without the first failed connection.

      See F5 for a work around if you want it to only do one pass. (it also shows directly messing with $soap->transport(), which gives you access to the SOAP::Transport object.)

        Thanks. It looks very good.
Re^4: Basic authentication in SOAP
by mrguy123 (Hermit) on Jul 20, 2006 at 13:48 UTC
    I see that I have been down voted twice by now (first time ever), and it probably looks like I want others to do the work for me. I think I should mention that I have been spending a lot of hours in the past few days trying to understand the SOAP::Lite module, which compared to other modules I worked with in the past is not that user friendly (a much longer discussion about this issue can be found here). I'm sorry if the questions aren't that great, but please be patient. Thanks for the help,
    Guy