OK. What I've been able to do is make a copy of getToken() so that I can modify it. I've now modified getToken() to look like this:
/**
* Function to return token for document viewer service.
*/
function getToken()
{
global $sugar_config;
$token = '';
try {
// set flag in php.ini file for soap call.
ini_set("soap.wsdl_cache_enabled", 0);
$options = array(
'exceptions'=>true,
'trace'=>1,
'cache'=>false,
'connection_timeout'=>15
);
$document_service_url=$sugar_config['document_service_url'];
$client = new SoapClient($document_service_url,$options);
$response = $client->GetToken();
$token=$response->GetTokenResult;
} catch (Exception $e) {
// echo "Caught Exception:".$e->getMessage()."\n";
//$GLOBALS['log']->fatal("Caught Exception:".print_r($e->getMessage(),1));
}
return $token;
}
The issue is that the connection_timeout option only addresses the time it takes to wait to connect to the host. I just found out that when our Document service is hanging, that we can connect to it, however, we just don't get a response. I saw someone mention using:
ini_set('default_socket_timeout', 15);
However, I believe that over SSL and as of PHP 5.2.3 default_socket_timeout does not work for SSL connections. 🙁
Now I'm stuck as to how to modify getToken() so that it doesn't hang after making a connection but hanging on a response. Any thoughts???