in modules/quanthub_core/src/XacmlSoapClient.php [80:137]
public function getDatasetList() {
$xml = $this->prepareXml();
// Credentials for authentication by wso Token.
$auth = "Bearer {$this->wsoToken->getToken()}";
try {
$response = $this->httpClient->post($this->route,
[
'verify' => FALSE,
'body' => $xml,
'headers' => [
'Authorization' => $auth,
'Content-Type' => 'application/xml',
],
]
);
}
catch (ConnectException $e) {
$this->loggerFactory->get('quanthub_core')->notice('Problem with getting Dataset list');
}
// Get dataset IDs from response from wso2.
$dataset_list = [];
if ($response->getStatusCode() == 200) {
// @todo need to check if xml or jsonlogic response.
$response_xml = new \SimpleXMLElement((string) $response->getBody());
$key = 0;
if (!empty($response_xml->Result->Obligations->Obligation)) {
foreach ($response_xml->Result->Obligations->Obligation as $obligation) {
if ($obligation->count() == 1) {
$dataset_list[$key] = (string) $obligation->AttributeAssignment;
}
elseif ($obligation->count() > 1) {
foreach ($obligation as $obligation_value) {
$dataset_list[$key][(string) $obligation_value->attributes()] = (string) $obligation_value;
}
}
$dataset_list[$key]['value'] = $dataset_list[$key]['Quanthub:Entity:Agency'] . ':' . $dataset_list[$key]['Quanthub:Entity:Code'];
unset(
$dataset_list[$key]['Quanthub:Entity:Agency'],
$dataset_list[$key]['Quanthub:Entity:Code']
);
if (!empty($dataset_list[$key]['Quanthub:Entity:Version'])) {
$dataset_list[$key]['value'] .= '(' . $dataset_list[$key]['Quanthub:Entity:Version'] . ')';
unset($dataset_list[$key]['Quanthub:Entity:Version']);
}
$dataset_list[$key] = $dataset_list[$key]['value'];
$key++;
}
}
// @todo need to write jsonLogic handler.
// JsonLogic::apply();
}
return $dataset_list;
}