diff --git a/ObjectHelper.inc b/ObjectHelper.inc index e9bebdfb..12f8dd9b 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -233,8 +233,8 @@ class ObjectHelper { elseif ((isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) { //If not anonymous, soap is force or we're using HTTPS //Have the webserver mediate the transfer (download and restream) - if (($contentSize = self::getDatastreamSize($pid, $dsID, TRUE)) > 0) { - header("Content-Length: $contentSize"); + if (($contentSize = self::getDatastreamSize($pid, $dsID, TRUE)) > 0) { + header("Content-Length: $contentSize"); } $opts = array( @@ -624,30 +624,9 @@ class ObjectHelper { * */ function getStream($pid, $dsid, $showError = FALSE) { - module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); - $soapHelper = new ConnectionHelper(); - try { - $client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); - $params = array( - 'pid' => "$pid", - 'dsID' => "$dsid", - 'asOfDateTime' => "" - ); - - if (!isset($client)) { - drupal_set_message(t('Error connection to Fedora using soap client.')); - return NULL; - } - $object = $client->__soapCall('getDatastreamDissemination', array('parameters' => $params)); - } catch (Exception $e) { - if ($showError) { - drupal_set_message(t('Error getting Datastream for %pid and %datastream
', array('%pid' => $pid, '%datastream' => $dsid)), 'error'); - } - return NULL; - } - $content = $object->dissemination->stream; - $content = trim($content); - return $content; + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $item = new fedora_item($pid); + return $item->get_datastream_dissemination($dsid); } /**