Ok, I've been working on this for a while now and it seems I've finally got a solution.

First a little background. The default behavior for a SOAP::Lite client connecting to an endpoint with authentication is to first make the request un-authenticated, and if the client receives a HTTP 401 error, the credentials are included in the HTTP headers and and identical request is made again to the server, this time the only thing different is the Auth header. This is good for the sake of security, but bad for overall performance for large sets of requests.

Until now, there hasn't been an easy way to "force" the client into passing the credentials up with the first connection. But, with SOAP::Lite v0.65, the authors have exposed the HTTP request object to the client code directly so these headers can be inserted to force a authenticated first connection.

...
$soapRequest = SOAP::Lite
  -> uri('target_uri')
  -> proxy($sURL);

$soapRequest->transport->http_request->header
(
  'Authorization' => 
    'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '')
);

$soapRequest->method_call();

Imagine an app that needs to make 100 calls, each taking 400ms for the default double request/response behavior. That would take a total of 40s to execute. Now, if we can reduce that time by, let's say, a conservative 30%, that would bring the total execution time down to under 30s. Not bad for one line of code.

As always, I'll get this incorporated into the next versions of the iControl SDK, which in the shortest term will be v9.2.

Hasta La Vista, double connections, Welcome faster apps!

-Joe