'sendDocument', 'signature' => Array(Array('integer', 'string', 'base64')), 'docstring' => 'Send a Maarch document'); $SOAP_dispatch_map['sendDocument'] = Array( 'in' => Array('gedId' => 'integer', 'tableName' => 'string'), 'out' => Array('out' => 'array') ); function sendDocument($gedId, $tableName){ $result = array(); try { $connexion = new dbquery(); $connexion->connect(); $connexion->query("select res_id, docserver_id, path, filename, format, fingerprint from ".$tableName." where res_id = ".$gedId); $line = $connexion->fetch_object(); $docserver = $line->docserver_id; $path = $line->path; $filename = $line->filename; $format = $line->format; $md5 = $line->fingerprint; $fingerprint_from_db = $line->fingerprint; $connexion->query("select path_template from ".$_SESSION['tablename']['docservers']." where docserver_id = '".$docserver."'"); $line_doc = $connexion->fetch_object(); $docserver = $line_doc->path_template; $file = $docserver.$path.$filename; $file = str_replace("#", DIRECTORY_SEPARATOR, $file); if(file_exists($file)){ $content = file_get_contents($file, FILE_BINARY); $encodedContent = base64_encode($content); $result[0] = true; $result[1] = $encodedContent; } else{ $content = "file not exists"; $result[0] = false; $result[1] = $content; } return $result; } catch (Exception $e) { $fault = new SOAP_Fault($e->getMessage(),'1'); return $fault->message(); } } $SOAP_dispatch_map['getDocumentList'] = Array( 'in' => Array('numDossier' => 'string', 'docType' => 'integer'), 'out' => Array('out' => '{urn:MySoapServer}arrayFolder') ); $SOAP_typedef['folderObject'] = Array( 'doc_id'=>'long', 'pole'=>'string', 'doc_date'=>'string' ); $SOAP_typedef['arrayFolder'] = array('item' => '{urn:MySoapServer}folderObject'); function getDocumentList($numDossier, $docType){ $result = array(); try { $connexion = new dbquery(); $connexion->connect(); $connexion->query("select res_id, entity_label, doc_date from res_view_letterbox where doc_custom_t2 = '".$numDossier."' and type_id = ".$docType); if ($connexion->nb_result() >0) { $result[0] = true; $cpt = 0; while($line = $connexion->fetch_object()) { $result[1][$cpt]['doc_id'] = $line->res_id; $result[1][$cpt]['pole'] = $line->entity_label; $result[1][$cpt]['doc_date'] = $line->doc_date; $cpt++; } } else { $result[0] = false; } return $result; } catch (Exception $e) { $fault = new SOAP_Fault($e->getMessage(),'1'); return $fault->message(); } } ?>