Browse Source

updated getStream function to use fedora_item to retrieve the datastream dissemination instead of calling soap directly, the result error filtering on the output

pull/129/head
Jason MacWilliams 13 years ago
parent
commit
13781d24f7
  1. 27
      ObjectHelper.inc

27
ObjectHelper.inc

@ -624,30 +624,9 @@ class ObjectHelper {
* *
*/ */
function getStream($pid, $dsid, $showError = FALSE) { function getStream($pid, $dsid, $showError = FALSE) {
module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$soapHelper = new ConnectionHelper(); $item = new fedora_item($pid);
try { return $item->get_datastream_dissemination($dsid);
$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<br />', array('%pid' => $pid, '%datastream' => $dsid)), 'error');
}
return NULL;
}
$content = $object->dissemination->stream;
$content = trim($content);
return $content;
} }
/** /**

Loading…
Cancel
Save