public function execute(TingClientHttpRequest $request)
 {
     $startTime = explode(' ', microtime());
     try {
         $response = $this->executeRequest($request);
         $stopTime = explode(' ', microtime());
         $time = floatval($stopTime[1] + $stopTime[0] - ($startTime[1] + $startTime[0]));
         $this->logger->log('Completed HTTP request ' . $request->getUrl() . ' (' . round($time, 3) . 's)');
         return $response;
     } catch (TingClientException $e) {
         $this->logger->log('Error handling HTTP request ' . $request->getUrl() . ' : ' . $e->getMessage());
         throw $e;
     }
 }
 public function execute(TingClientRequest $request)
 {
     //Prepare the parameters for the SOAP request
     $soapParameters = $request->getParameters();
     // Separate the action from other parameters
     $soapAction = $soapParameters['action'];
     unset($soapParameters['action']);
     // We use JSON as the default outputType.
     if (!isset($soapParameters['outputType'])) {
         $soapParameters['outputType'] = 'json';
     }
     try {
         try {
             $startTime = explode(' ', microtime());
             // Add option to send CURL parameters with the request. This can be used
             // to send requests through a SOCKS5 ssh proxy.
             $curl_options = array();
             if (function_exists('variable_get')) {
                 $curl_options = variable_get('curl_options', array());
             }
             $client = new NanoSOAPClient($request->getWsdlUrl(), array('curl' => $curl_options));
             $response = $client->call($soapAction, $soapParameters);
             $stopTime = explode(' ', microtime());
             $time = floatval($stopTime[1] + $stopTime[0] - ($startTime[1] + $startTime[0]));
             $this->logger->log('Completed SOAP request ' . $soapAction . ' ' . $request->getWsdlUrl() . ' (' . round($time, 3) . 's). Request body: ' . $client->requestBodyString);
             // If using JSON and DKABM, we help parse it.
             if ($soapParameters['outputType'] == 'json') {
                 return $request->parseResponse($response);
             } else {
                 return $response;
             }
         } catch (NanoSOAPcURLException $e) {
             //Convert NanoSOAP exceptions to TingClientExceptions as callers
             //should not deal with protocol details
             throw new TingClientException($e->getMessage(), $e->getCode());
         }
     } catch (TingClientException $e) {
         $this->logger->log('Error handling SOAP request ' . $soapAction . ' ' . $request->getWsdlUrl() . ': ' . $e->getMessage());
         throw $e;
     }
 }