Vérifier la configuration de Maarchcapture
Vérifier le script Maarchcapture s'execute correcetement
Vérifier le script Maarchcapture s'execute via la crontab
<process name="MaarchRestWSProcessFromMail">
<loop xpath="/Batch/Documents/Document">
<call name="/contacts" method="POST">
<argument type="entity" name="firstname" metadata="contact_firstname"/>
<argument type="entity" name="lastname" metadata="contact_name"/>
<argument type="entity" name="email" metadata="email"/>
<argument type="entity" name="addressStreet" metadata="address_street"/>
<argument type="entity" name="addressPostcode" metadata="address_postal_code"/>
<argument type="entity" name="addressTown" metadata="address_town"/>
<return>
<id metadata="id" />
</return>
</call>
<call name="/resources" method="POST">
<argument type="entity" name="modelId">1</argument>
<argument type="entity" name="encodedFile" eval="base64_encode(file_get_contents($Element->path))"/>
<argument type="entity" name="format" attribute="extension"/>
<argument type="entity" name="status">INIT</argument>
<argument type="entity" name="chrono">true</argument>
<argument type="entity" name="doctype" metadata="type_id"/>
<argument type="entity" name="subject" metadata="subject"/>
<argument type="entity" name="documentDate" metadata="doc_date"/>
<argument type="entity" name="destination" metadata="destination"/>
<argument type="entity" name="initiator" metadata="destination"/>
<argument type="entity" name="priority">poiuytre1357nbvc</argument>
<argument type="entity" name="senders" eval="[["id" => $Element->getMetadata("id"), "type" => "contact"]]"/>
<return>
<resId metadata="resId" />
</return>
</call>
<loop xpath="Attachments/Attachment">
<call name="/attachments" method="POST">
<argument type="entity" name="resIdMaster" xvalue="ancestor::Document/Metadata/resId"/>
<argument type="entity" name="type">incoming_mail_attachment</argument>
<argument type="entity" name="encodedFile" eval="base64_encode(file_get_contents($Element->path))"/>
<argument type="entity" name="format" attribute="extension"/>
<argument type="entity" name="title" metadata="filename"/>
<return>
<id metadata="resId" />
</return>
</call>
</loop>
</loop>
</process>
root@MaarchCourrier:/opt/maarch/MaarchCapture/config# vi Capture.xml
<!-- SCAN TO MAARCHCOURRIER SAMPLE WITH QRCODE SEPARATION -->
<batch name="SCAN_MASS" directory="/media/disk1/file_maarch_capture/" id="{batchname}-{timestamp}-{rand}" lock="0">
<workflow name="SCAN_MASS" debug="false" logMode="Maarch" maarchLogParam="/var/www/MaarchCourrier/custom/cs_MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml" maarchLoggerName="loggerTechnique">
<step function="separatePDF" module="QRSeparator" name="separatePDF">
<input name="ScanSource">/home/maarch/depot/mcc/maarchcourrier/</input>
Vérifier que le repértoire SCAN_MASS directory (dans l'exemple ="/media/disk1/file_maarch_capture/") existe et a les bons droits (droits d'ecriture par maarch et que les scans arrivent bien à cet emplacement
vérifier que document scanné arrivé bien au répertoire ScanSource (dans l'exemple " /home/maarch/depot/mcc/maarchcourrier/")
Vérifier que les chemins existent et disposent de suffisamment d'espace
Lancer le script avec le bon user soit comme ça :
./var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/scripts/CAPTURE.sh
ou comme ça maarch@MaarchCourrier:/opt/maarch/MaarchCapture$ php MaarchCapture.php init -BatchName SCAN_MASS
Ensuite consulter la log :
maarch@MaarchCourrier:/media/disk1/file_maarch_capture$ cat BSCAN_MASS-1563885961-1918389758/WSCAN_MASS-1563885961-1918389758.log
Vérifier l'utilisateur qui execute le script et des droits du script correspondent
root@SRVL-MAARCH:/etc/cron.d# cat MAARCH
#####capture des mails et des scans####
* * * * * root /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/scripts/CAPTURE.sh > /tmp/scans.txt
0 0 * * * root rm -Rf /var/www/html/maarch_courrier/custom/cs_maarch_db/modules/maarch_capture/files/maarchcourrier/B*
c'est un php utilisé pour tester la connexion au serveur imap
root@MaarchCourrier:/opt/maarch/MaarchCapture/modules/MailCapture/scripts# php test_imap.php
******************* TEST 0 *********************
hostname : {2013.ex10.biz}
login :
password :
launch imap_open
PHP Warning: imap_open(): Couldn't open stream {2013.ex10.biz} in /opt/maarch/MaarchCapture/modules/MailCapture/scripts/test_imap.php on line 35
Warning: imap_open(): Couldn't open stream {2013.ex10.biz} in /opt/maarch/MaarchCapture/modules/MailCapture/scripts/test_imap.php on line 35
CONNECTION FAILED !!!!!!!!!!!!!!!!!!!!!!
var_dump imap_errors
array(2) {
[0]=>
string(28) "rsh to IMAP server timed out"
[1]=>
string(60) "Connection failed to 2013.ex10.biz,143: Connection timed out"
}
************************************************
CONNECTION FAILED => on établie pas le lien imap
TLS/SSL failure for 172.20.*.: SSL negotiation failed => quand on tente de se connecter au serveur mail en imap par le protocole TLS ou SSL la négociation échoue
une négociation qui échoue est une négociation qui n'a
=> soit pas eu de réponse => pas de réponse = pas de serveur ou indisponible sur se port
=> soit une réponse négative => mauvais mot de passe / id / certificat / ect
Il est possible également que l'information pour se connecter (hostname) n'est pas bien renseigné
Installer les 9 10 et 11
https://support.microsoft.com/fr-fr/help/2977003/the-latest-supported-visual-c-downloads
télécharger ce fichier
maarch@SV-MAARCH-WEB:/var/www/html/MaarchCourrier/mcc/logs$ tail -f mcc_server.log
[14/10/2019 08:00:07] createWs : false
[14/10/2019 08:00:07][ERRNO]1[ERRNO][ERROR]No file uploaded ![ERROR]
[14/10/2019 08:19:14] Application start with : /var/www/html/MaarchCourrier/cs_maarch/mcc/mcc_server.php
[14/10/2019 08:19:14] Loading xml config file : config/config_mcc.xml
[14/10/2019 08:19:14] mccPath : /var/www/html/MaarchCourrier/mcc/
[14/10/2019 08:19:14] maarchTmpPath : /opt/maarch/
[14/10/2019 08:19:14] targetPath : /var/www/html/MaarchCourrier/mcc/outcome/
[14/10/2019 08:19:14] createIndex : false
[14/10/2019 08:19:14] createWs : false
[14/10/2019 08:19:14][ERRNO]1[ERRNO][ERROR]No file uploaded ![ERROR]
redémarrage du serveur apache
maarch@SV-MAARCH-WEB:/var/www/html/MaarchCourrier/custom/cs_maarch/modules/MaarchCapture/files/BMAARCH_MAIL_TO_MC-1592230203-221617274$ cat WMAARCH_MAIL_TO_MC-1592230203-221617274.log
2020-06-15T16:10:03+02:00 [0] Initializing workflow MAARCH_MAIL_TO_MC
2020-06-15T16:10:03+02:00 [0] (Re)Starting workflow MAARCH_MAIL_TO_MC
2020-06-15T16:10:03+02:00 [0] Initializing step CAPTURE_MAIL_1
2020-06-15T16:10:03+02:00 [0] Starting step CAPTURE_MAIL_1
2020-06-15T16:10:03+02:00 [2] Connection failed to imap.******.fr,143: Connection refused
2020-06-15T16:10:03+02:00 [2] Connection failed to imap.******.fr,143: Connection refused
2020-06-15T16:10:03+02:00 [2] Error(s) occured during function imap_open
=> vérifier que les ports sont bien ouverts
maarch@SV-MAARCH-WEB:/var/www/html/MaarchCourrier/custom/cs_maarch/modules/MaarchCapture/files$ cat /var/www/html/MaarchCourrier/custom/cs_maarch/modules/MaarchCapture/files//BMAARCH_MAIL_TO_MC-1592464741-1141075669/D1__MaarchWSClient__#resources__return.log
Array
(
[errors] => Authentication Failed
)
Vous avez du nouveau courrier dans /var/mail/maarch
maarch@SV-MAARCH-WEB:/var/www/html/MaarchCourrier/custom/cs_maarch/modules/MaarchCapture/files/errors/BMAARCH_MAIL_TO_MC-1592464741-1141075669$ cat WMAARCH_MAIL_TO_MC-1592464741-1141075669.log
2020-06-18T09:19:01+02:00 [0] Initializing workflow MAARCH_MAIL_TO_MC
2020-06-18T09:19:01+02:00 [0] (Re)Starting workflow MAARCH_MAIL_TO_MC
2020-06-18T09:19:01+02:00 [0] Initializing step CAPTURE_MAIL_1
2020-06-18T09:19:01+02:00 [0] Starting step CAPTURE_MAIL_1
2020-06-18T09:19:01+02:00 [0] Step completed in 0.479 seconds
2020-06-18T09:19:01+02:00 [0] Saving batch on disk...
2020-06-18T09:19:01+02:00 [0] Batch saved in 0.000 seconds
2020-06-18T09:19:01+02:00 [0] Initializing step SendToMaarch
2020-06-18T09:19:01+02:00 [0] Starting step SendToMaarch
2020-06-18T09:19:01+02:00 [2] ERROR Bad WS Response format: return resId is not set. Return dump output generated in file '/var/www/html/MaarchCourrier/custom/cs_maarch/modules/MaarchCapture/files//BMAARCH_MAIL_TO_MC-1592464741-1141075669/D1__MaarchWSClient__#resources__return.log'.
2020-06-18T09:19:01+02:00 [3] ERROR Bad WS Response format: return resId is not set. Return dump output generated in file '/var/www/html/MaarchCourrier/custom/cs_maarch/modules/MaarchCapture/files//BMAARCH_MAIL_TO_MC-1592464741-1141075669/D1__MaarchWSClient__#resources__return.log'.
2020-06-18T09:19:01+02:00 [3] Process error! See previous messages for more information.
2020-06-18T09:19:01+02:00 [0] return value from web service /resources resId :
2020-06-18T09:19:01+02:00 [0] Step completed in 0.076 seconds
2020-06-18T09:19:01+02:00 [0] Saving batch on disk...
2020-06-18T09:19:01+02:00 [0] Batch saved in 0.000 seconds
Vous avez du nouveau courrier dans /var/mail/maarch
=> Vérifier le fichier MaarchWSClient_standard.xml Il est possible que le mot de passe du comtpte ws ait été modifié
cat /var/www/html/MaarchCourrier/custom/cs_maarch/modules/MaarchCapture/modules/MaarchWSClient/MaarchWSClient_standard.xml
cat /opt/maarch/MaarchCapture/modules/MaarchWSClient
root@srv-maarchrecette:/opt/maarch/MaarchCapture/files/errors/BSCAN_MASS-1592923801-1011124017# cat D1__MaarchWSClient__#resources__return.log
Array
(
[errors] => Body is not set or empty
)
root:/opt/maarch/MaarchCapture/files/errors/BSCAN_MASS-1592923801-1011124017# cat WSCAN_MASS-1592923801-1011124017.log
2020-06-23T16:50:01+02:00 [0] Initializing workflow SCAN_MASS
2020-06-23T16:50:01+02:00 [0] (Re)Starting workflow SCAN_MASS
2020-06-23T16:50:02+02:00 [0] Initializing step separatePDF
2020-06-23T16:50:02+02:00 [0] Starting step separatePDF
2020-06-23T16:50:02+02:00 [0] Init process ...
2020-06-23T16:50:02+02:00 [0] There is 1 to process
2020-06-23T16:50:02+02:00 [0] * File n°1: DOC230620-23062020164805.pdf *
2020-06-23T16:50:02+02:00 [0] Page 1 split into /opt/maarch/MaarchCapture/files//BSCAN_MASS-1592923801-1011124017/2/1.pdf
2020-06-23T16:50:02+02:00 [0] Page 2 split into /opt/maarch/MaarchCapture/files//BSCAN_MASS-1592923801-1011124017/2/2.pdf
2020-06-23T16:50:02+02:00 [0] Page 3 split into /opt/maarch/MaarchCapture/files//BSCAN_MASS-1592923801-1011124017/2/3.pdf
2020-06-23T16:50:02+02:00 [0] Page 4 split into /opt/maarch/MaarchCapture/files//BSCAN_MASS-1592923801-1011124017/2/4.pdf
2020-06-23T16:50:02+02:00 [0] Page 5 split into /opt/maarch/MaarchCapture/files//BSCAN_MASS-1592923801-1011124017/2/5.pdf
2020-06-23T16:50:02+02:00 [0] Page 6 split into /opt/maarch/MaarchCapture/files//BSCAN_MASS-1592923801-1011124017/2/6.pdf
2020-06-23T16:50:02+02:00 [0] Page 7 split into /opt/maarch/MaarchCapture/files//BSCAN_MASS-1592923801-1011124017/2/7.pdf
2020-06-23T16:50:02+02:00 [0] This is a separator ! Extract name ...
2020-06-23T16:50:02+02:00 [0] This is a maarch document page ! Add page to pdf ...
2020-06-23T16:50:03+02:00 [0] This is a maarch document page ! Add page to pdf ...
2020-06-23T16:50:03+02:00 [0] This is a maarch document page ! Add page to pdf ...
2020-06-23T16:50:03+02:00 [0] This is a maarch document page ! Add page to pdf ...
2020-06-23T16:50:04+02:00 [0] This is a maarch document page ! Add page to pdf ...
2020-06-23T16:50:04+02:00 [0] This is a maarch document page ! Add page to pdf ...
2020-06-23T16:50:04+02:00 [0] End of merge pdf for service : COURRIER
2020-06-23T16:50:04+02:00 [0] Document D1 added with source /opt/maarch/MaarchCapture/files//BSCAN_MASS-1592923801-1011124017/COURRIER_2020062316061252084879.pdf
2020-06-23T16:50:04+02:00 [0] End of process ...
2020-06-23T16:50:04+02:00 [0] Step completed in 2.490 seconds
2020-06-23T16:50:04+02:00 [0] Saving batch on disk...
2020-06-23T16:50:04+02:00 [0] Batch saved in 0.000 seconds
2020-06-23T16:50:04+02:00 [0] Initializing step SendToMaarch
2020-06-23T16:50:04+02:00 [0] Starting step SendToMaarch
2020-06-23T16:50:04+02:00 [2] ERROR Bad WS Response format: return resId is not set. Return dump output generated in file '/opt/maarch/MaarchCapture/files//BSCAN_MASS-1592923801-1011124017/D1__MaarchWSClient__#resources__return.log'.
2020-06-23T16:50:04+02:00 [3] ERROR Bad WS Response format: return resId is not set. Return dump output generated in file '/opt/maarch/MaarchCapture/files//BSCAN_MASS-1592923801-1011124017/D1__MaarchWSClient__#resources__return.log'.
2020-06-23T16:50:04+02:00 [3] Process error! See previous messages for more information.
2020-06-23T16:50:04+02:00 [0] return value from web service /resources resId :
2020-06-23T16:50:04+02:00 [0] Step completed in 0.082 seconds
2020-06-23T16:50:04+02:00 [0] Saving batch on disk...
2020-06-23T16:50:04+02:00 [0] Batch saved in 0.000 seconds
une fois toutes les vérifications faites, il s'est avéré que le repertoire /tmp était plein
une fois /tmp vidé il fallait également redemarrer le service apache
service httpd ou service apache2 status ou systemctl status apache2
En fonction de l'Os :
service httpd restart ou service apache2 restart ou systemctl restart httpd
Si vous obtenez l'erreur suivante :
root@ce92c374fec9:/var/www/capture/scripts# ./MAARCH_FILE_IMPORT.sh
********************************************************************************
** Maarch Capture **
** (c) since 2008 Maarch SAS **
********************************************************************************
Initialize new Capture process...
Instanciate new Capture processor...
Create new batch 'MAARCH_FILE_IMPORT'...
error directory /var/www/capture/files//errors
Batch created with id 'BMAARCH_FILE_IMPORT-1622105887-216182126'
Initialize workflow 'MAARCH_SCAN_TO_MC'...
Workflow initialized with id 'WMAARCH_FILE_IMPORT-1622105887-216182126'
Get first workflow step name...
Next step name is 'ImportFiles'
MaarchCapture step inputs: Array
(
[0] => Directory
[1] => Target
[2] => Action
[3] => MoveDirectory
[4] => Recursive
[5] => CreateFolders
)
MaarchCapture step: Array
(
[positional] => Array
(
)
[executable] => MaarchCapture.php
[command] => Array
(
[opts] => Array
(
[positional] => Array
(
)
[ConfigName] => Capture
[executable] => init
[BatchName] => MAARCH_FILE_IMPORT
)
[name] => init
)
)
Capture::processStep(ImportFiles)
control of /data//test.pdf
Capture::processStep(SendToMaarch)
Capture::catchError with message 'ERROR Bad WS Response format: return resId is not set. Return dump output generated in file '/var/www/capture/files//BMAARCH_FILE_IMPORT-1622105887-216182126/D1__MaarchWSClient__#resources__return.log'.'
ok
Vérifier que les champs suiavnts sont bien reseignés et que les identifiants correspondent à ceux MaarchCourrier:
<?xml version="1.0" encoding="UTF-8"?>
<MaarchWSClient>
<!-- REST FRONTAL -->
<WS name="MaarchRestWS" type="REST" uri="http://cchaplin:maarch@127.0.0.1/MaarchCourrier/maarch2103/rest/"></WS>
<!-- REST SAMPLES -->
<process name="MaarchRestWSProcessFromScan">
<loop xpath="/Batch/Documents/Document">
<call name="/resources" method="POST">
<argument type="entity" name="modelId">1</argument>
<argument type="entity" name="encodedFile" eval="base64_encode(file_get_contents($Element->path))"/>
<argument type="entity" name="format" attribute="extension"/>
<argument type="entity" name="doctype">108</argument>
<argument type="entity" name="chrono">true</argument>
<argument type="entity" name="destination">13</argument>
<argument type="entity" name="priority">poiuytre1391nbvc</argument>
<argument type="entity" name="status">INIT</argument>
<return>
<resId metadata="resId" />
</return>
</call>
</loop>
</process>
<process name="MaarchRestWSProcessFromMail">
<loop xpath="/Batch/Documents/Document">
<call name="/resources" method="POST">
<argument type="entity" name="modelId">1</argument>
<argument type="entity" name="encodedFile" eval="base64_encode(file_get_contents($Element->path))"/>
<argument type="entity" name="format" attribute="extension"/>
<argument type="entity" name="status">INIT</argument>
<argument type="entity" name="chrono">true</argument>
<argument type="entity" name="doctype" metadata="type_id"/>
<argument type="entity" name="subject" metadata="subject"/>
<argument type="entity" name="documentDate" metadata="doc_date"/>
<argument type="entity" name="destination" metadata="destination"/>
<argument type="entity" name="initiator" metadata="destination"/>
<argument type="entity" name="priority">poiuytre1391nbvc</argument>
<return>
<resId metadata="resId" />
</return>
</call>
<loop xpath="Attachments/Attachment">
<call name="/attachments" method="POST">
<argument type="entity" name="resIdMaster" xvalue="ancestor::Document/Metadata/resId"/>
<argument type="entity" name="type">incoming_mail_attachment</argument>
<argument type="entity" name="encodedFile" eval="base64_encode(file_get_contents($Element->path))"/>
<argument type="entity" name="format" attribute="extension"/>
<argument type="entity" name="title" metadata="filename"/>
<return>
<id metadata="resId" />
</return>
</call>
</loop>
</loop>
</process>
</MaarchWSClient>
Nb: préciser le nom du custom dans l'uri