There's more than one way to do things | |
PerlMonks |
Sending HTTP credentials with SOAPby astroboy (Chaplain) |
on Mar 17, 2010 at 01:37 UTC ( [id://829059]=perlquestion: print w/replies, xml ) | Need Help?? |
astroboy has asked for the wisdom of the Perl Monks concerning the following question: Hi In have a class generated by SOAP::WSDL for a resource that requires Basic Authentication. The usual way to provide the credentials is to put something like this in your code
The underlying HTTP transport, LWP::UserAgent, won't supply the credentials until it receives either a HTTP::Status::RC_UNAUTHORIZED or a HTTP::Status::RC_PROXY_AUTHENTICATION_REQUIRED status code (401 or 407, I believe). This is correct, as specified in RFC2616. Unfortunately, the SOAP service returns a 501 status, and a fault stating that the Basic Authentication credentials were never received. So I need a away around this. One way to to edit the class generated by SOAP::WSDL, and supply the credentials in the proxy = e.g. http://user:password@service. However, I really want to avoid this, as it will mean that I've hard-coded the authentication details in a package, which then isn't shareable by anyone else wishing to call the same service, and if I need to generate packages from the WSDL again, I''ll lose the credentials So can anyone see a way around this?
Back to
Seekers of Perl Wisdom
|
|