You are here

function CommonCMISService::doRequest in CMIS API 7

Same name and namespace in other branches
  1. 6.4 cmis_common/cmis_common.utils.inc \CommonCMISService::doRequest()
  2. 6.3 cmis_common/cmis_common.utils.inc \CommonCMISService::doRequest()
  3. 7.2 cmis_common/cmis_common.utils.inc \CommonCMISService::doRequest()

Overrides CMISRepositoryWrapper::doRequest

File

cmis_common/cmis_common.utils.inc, line 5

Class

CommonCMISService

Code

function doRequest($url, $method = 'GET', $content = NULL, $contentType = NULL, $charset = NULL) {
  if (!empty($this->workspace) && !empty($this->workspace->repositoryInfo->repositoryId)) {
    $repoId = $this->workspace->repositoryInfo->repositoryId;
  }
  else {
    $repoId = 'default';
  }
  $result = cmis_invoke($repoId, $url, array(
    'method' => $method,
    'data' => $content,
    'headers' => array(
      'Content-Type' => $contentType . (!is_null($charset) ? '; charset=' . $charset : ''),
    ),
  ));
  $retval = new stdClass();
  $retval->url = $url;
  $retval->method = $method;
  $retval->content_sent = $content;
  $retval->content_type_sent = $contentType;
  $retval->body = $result->body;
  $retval->code = $result->code;
  $retval->content_type = $result->content_type;
  $retval->content_length = $result->content_length;
  $this->last_request = $retval;
  return $retval;
}