Forum Discussion
May 09, 2005
I've been looking at this for a while and as luck will have it, in version 0.65 of SOAP::Lite, the authors have exposed the HTTP request object allowing custom insertion of HTTP headers. This allows the user, in the client code, to inject the Authenticate header thus eliminating the need for the infamous request-with-no-auth, 401-error, request-with-auth, 200-success. By including the following line after your SOAP::Lite object instantiation, you'll bypass half of the round trips needed!
Here's a sample taken from the SystemInfo.pl sample from the SDK.
...
$soap = SOAP::Lite
-> uri('urn:iControl:System/SystemInfo')
-> proxy($sURL);
$soap->transport->http_request->header
(
'Authorization' => 'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '')
);
I haven't performed timing tests yet, but this should reduce the total time by a good chunk. Not 50%, but a good chunk.
-Joe