diff --git a/MaarchREST.class.php b/MaarchREST.class.php index 3e5c940c05805aeb9a81e0839b8fcf757c0851e4..d5f2c9bea27d54cf5f891a6206e6c88055c4b432 100644 --- a/MaarchREST.class.php +++ b/MaarchREST.class.php @@ -55,10 +55,10 @@ class MaarchREST extends SAEConnecteur { $curlWrapper = $this->curlWrapperFactory->getInstance(); $bodyPackage = $this->createPackageSource($seda_message_path, $attachments_path); - + $curlWrapper->setJsonPostData($bodyPackage); - return $this->getWS('/transfer/source', "application/json", $curlWrapper); + return $this->getWS('/medona/archiveTransfer/source', "application/json", $curlWrapper); } public function createPackageSource($seda_message_path, $attachments_path) { @@ -82,12 +82,14 @@ class MaarchREST extends SAEConnecteur { } $sourcePackage = []; - $package = new stdClass(); - $package->connector = "seda2zip"; - $package->params = []; - $package->params['manifest'] = "bordereau.xml"; - $package->package = base64_encode(file_get_contents($zipFilePath)); - $sourcePackage[] = $package; + $package = base64_encode(file_get_contents($zipFilePath)); + $sourcePackage['package'] = new stdClass(); + $sourcePackage['package']->data = $package; + $sourcePackage['package']->encoding = "base64"; + $sourcePackage['params'] = []; + $sourcePackage['params']['manifest'] = "bordereau.xml"; + $sourcePackage['connector'] = "seda2zip"; + unset($zipFilePath); @@ -162,16 +164,12 @@ class MaarchREST extends SAEConnecteur { // array_push($bodyPackage['attachments'], $attachment); // } // } - - // var_dump($bodyPackage); exit; // Chemin de base où les fichiers et dossiers sont stockés $baseDirectory = $tmpFolder . "/tmpFiles"; $this->addFilesFromDirectory($baseDirectory, $bodyPackage); - // var_dump($bodyPackage); exit; - rmdir($tmpFolder."/tmpFiles"); return $bodyPackage; @@ -206,7 +204,7 @@ class MaarchREST extends SAEConnecteur { * @throws Exception */ public function getAcuseReception($id_transfert) { - return $this->getAck($id_transfert, $this->originatingAgency); + return $this->getAck($id_transfert, "test"); } /** @@ -360,6 +358,7 @@ class MaarchREST extends SAEConnecteur { $curlWrapper->dontVerifySSLCACert(); $result = $curlWrapper->get($this->url.$url); + if (! $result){ throw new Exception($curlWrapper->getLastError()); }