diff --git a/src/app/external/externalSignatoryBook/controllers/IParapheurController.php b/src/app/external/externalSignatoryBook/controllers/IParapheurController.php index a0c338bf45eaca706efbc0048559da6262e03ab8..f3f8f7bf1bd0571f26ae26ad28b34f0aa9b08aab 100755 --- a/src/app/external/externalSignatoryBook/controllers/IParapheurController.php +++ b/src/app/external/externalSignatoryBook/controllers/IParapheurController.php @@ -283,7 +283,14 @@ class IParapheurController return ['error' => $curlReturn['error']]; } - $response = $curlReturn['response']->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children('http://www.adullact.org/spring-ws/iparapheur/1.0')->GetHistoDossierResponse[0]; + try { + if (is_bool($curlReturn['response']) === true) { + return ['error' => 'Curl response is a boolean']; + } + $response = $curlReturn['response']->children('http://schemas.xmlsoap.org/soap/envelope/')->Body->children('http://www.adullact.org/spring-ws/iparapheur/1.0')->GetHistoDossierResponse[0]; + } catch (Exception $e) { + return ['error' => 'Exception : ' . $e->getMessage()]; + } if ($response->MessageRetour->codeRetour == $aArgs['config']['data']['errorCode']) { return ['error' => 'Error : [' . $response->MessageRetour->severite . ']' . $response->MessageRetour->message]; diff --git a/src/core/models/CurlModel.php b/src/core/models/CurlModel.php index 482e86a68bf883ca1a4487ac7485150317344769..703cd494fccdca9c8236d8abcc8438a5030ad5b6 100755 --- a/src/core/models/CurlModel.php +++ b/src/core/models/CurlModel.php @@ -152,7 +152,7 @@ class CurlModel } $rawResponse = substr($rawResponse, $infos['header_size']); } elseif (!empty($aArgs['delete_header'])) { // Delete header for iparapheur - $body = explode(PHP_EOL . PHP_EOL, $rawResponse)[1]; // put the header ahead + $body = strstr($rawResponse, '<?xml'); // put the header ahead if (empty($body)) { $body = explode(PHP_EOL, $rawResponse); // we remove the 4 starting item of the array (header)