public function sendHttpRequest(array $requestData, $method = 'POST')
    {
        // Perform re-login if required.
        if ('getchallenge' !== $requestData[ 'operation' ] && time() > $this->serviceExpireTime) {
            $this->login($this->userName, $this->accessKey);
        }

        $requestData[ 'sessionName' ] = $this->sessionName;
        
        try {
            switch ($method) {
                case 'GET':
                    $response = $this->httpClient->get($this->wsBaseURL, [ 'query' => $requestData, 'timeout' => $this->requestTimeout ]);
                    break;
                case 'POST':
                    $response = $this->httpClient->post($this->wsBaseURL, [ 'form_params' => $requestData, 'timeout' => $this->requestTimeout ]);
                    break;
                default:
                    throw new WSException("Unsupported request type {$method}");
            }
        } catch (RequestException $ex) {
            $urlFailed = $this->httpClient->getConfig('base_uri').$this->wsBaseURL;
            throw new WSException(
                sprintf('Failed to execute %s call on "%s" URL', $method, $urlFailed),
                'FAILED_SENDING_REQUEST',
                $ex
            );
        }

        $jsonRaw = $response->getBody();
        $jsonObj = json_decode($jsonRaw, true);

        $result = (is_array($jsonObj) && !self::checkForError($jsonObj))
            ? $jsonObj[ 'result' ]
            : null;
        return $result;
    }