$Action = $Action_node->get_content(); if ($Action == "") { $failure_response = array("You must set the Action of the Request"); $error_code = array("XDSRepositoryActionError"); $SOAPED_failure_response = makeSoapedFailureResponse($failure_response, $error_code, $Action, $MessageID); $file_input = $idfile . "-SOAPED_Action_failure.xml"; writeTmpFiles($SOAPED_failure_response, $file_input, true); SendResponseFile($_SESSION['tmp_path'] . $file_input); exit; } elseif ($Action != "urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b") { $failure_response = array("This is a Provide And Register Document Set-b transaction and you don't use the Action urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-b"); $error_code = array("XDSRepositoryActionError"); $SOAPED_failure_response = makeSoapedFailureResponse($failure_response, $error_code, $Action, $MessageID); $file_input = $idfile . "-SOAPED_Action_failure.xml"; writeTmpFiles($SOAPED_failure_response, $file_input, true); SendResponseFile($_SESSION['tmp_path'] . $file_input); exit; } //Ottengo MessageID $MessageID_array = $root_completo->get_elements_by_tagname("MessageID"); $MessageID_node = $MessageID_array[0]; $MessageID = $MessageID_node->get_content(); $_SESSION['messageID'] = $MessageID; #### ebXML $dom_SOAP_ebXML = domxml_open_mem($ebxml_imbustato_soap); $root_SOAP_ebXML = $dom_SOAP_ebXML->document_element(); $dom_SOAP_ebXML_node_array = $root_SOAP_ebXML->get_elements_by_tagname("SubmitObjectsRequest"); for ($i = 0; $i < count($dom_SOAP_ebXML_node_array); $i++) { $node = $dom_SOAP_ebXML_node_array[$i]; $ebxml_STRING = $dom_SOAP_ebXML->dump_node($node); }
$mtime = explode(" ", $mtime); $mtime = $mtime[1] + $mtime[0]; $endtime = $mtime; $totaltime = number_format($endtime - $starttime, 15); $STAT_QUERY = "INSERT INTO STATS (REPOSITORY,DATA,EXECUTION_TIME,OPERATION) VALUES ('" . $_SERVER['REMOTE_ADDR'] . "',CURRENT_TIMESTAMP,'{$totaltime}','STOREDQUERY-B')"; $ris = query_exec2($STAT_QUERY, $connessione); writeSQLQueryService($ris . ": " . $STAT_QUERY); } ###################################################################### #### METTO L'ebXML SU STRINGA $ebXML_Response_SOAPED_string = makeSoapedSuccessStoredQueryResponse($Action, $MessageID, $ebXML_Response_string); ### SCRIVO LA RISPOSTA IN UN FILE $file_input = $idfile . "-ebxmlResponseSOAP.xml"; writeTmpQueryFiles($ebXML_Response_SOAPED_string, $file_input, true); writeTimeFile($idfile . "--StoredQuery: Creo file ebxmlResponseSOAP"); SendResponseFile($tmpQueryService_path . $file_input); //SendResponse($ebXML_Response_SOAPED_string,"application/soap+xml",(string)filesize($tmpQueryService_path.$idfile."-ebxmlResponseSOAP.xml")); // Clean tmp folder $system = PHP_OS; $windows = substr_count(strtoupper($system), "WIN"); if ($clean_cache == "O") { if ($windows > 0) { exec('del tmpQueryService\\' . $idfile . "* /q"); } else { exec('rm -Rf ' . $tmpQueryService_path . $idfile . "*"); } } unset($_SESSION['tmp_path']); unset($_SESSION['idfile']); unset($_SESSION['logActive']); unset($_SESSION['log_query_path']);
} ## CONFRONTO XDSDocumentEntry.patientId vs XDSFolder.patientId CASO ADD DOCUMENT // se $isAddAllowed_array[0] è falso dà errore $isAddAllowed_array = verifyAddDocToFolder($dom_ebXML, $XDSDocumentEntryPatientId_arr, $connessione); $error_code_array = array_merge($ExtrinsicObject_mimeType_array[2], $DocumentEntryPatientId_valid_array[4], $DocumentEntryUniqueId_valid_array[4], $Replacement_valid_array[2], $Append_valid_array[2], $SubmissionSetPatientId_valid_array[3], $SubmissionSetUniqueId_valid_array[2], $FolderUniqueId_valid_array[3], $hsu[2], $FolderPatientId_valid_array[2], $conf_PatientIds_arr[2], $isAddAllowed_array[2]); $failure_response_array = array_merge($ExtrinsicObject_mimeType_array[1], $DocumentEntryPatientId_valid_array[1], $DocumentEntryUniqueId_valid_array[1], $Replacement_valid_array[1], $Append_valid_array[1], $SubmissionSetPatientId_valid_array[1], $SubmissionSetUniqueId_valid_array[1], $FolderUniqueId_valid_array[1], $hsu[1], $FolderPatientId_valid_array[1], $conf_PatientIds_arr[1], $isAddAllowed_array[1]); ###### CASO DI VALIDAZIONE ===NON=== PASSATA if ($ExtrinsicObject_mimeType_array[0] || $DocumentEntryPatientId_valid_array[0] || !$Replacement_valid_array[0] || !$Append_valid_array[0] || !$DocumentEntryUniqueId_valid_array[0] || $SubmissionSetPatientId_valid_array[0] || !$SubmissionSetUniqueId_valid_array[0] || !$FolderUniqueId_valid_array[0] || !$hsu[0] || !$FolderPatientId_valid_array[0] || $conf_PatientIds_arr[0] || !$isAddAllowed_array[0]) { ### COMPONGO IL CORE DEL MESSAGGIO DI FAIL writeTimeFile($idfile . "--Registry: NON HO SUPERATO I VINCOLI DI VALIDAZIONE"); ### RESTITUISCE IL MESSAGGIO DI FAIL IN SOAP $SOAPED_failure_response = makeSoapedFailureResponse($failure_response_array, $error_code_array); ### SCRIVO LA RISPOSTA IN UN FILE $file_input = $idfile . "-SOAPED_failure_response.xml"; writeTmpFiles($SOAPED_failure_response, $file_input, true); SendResponseFile($tmp_path . $file_input); //SendResponse($SOAPED_failure_response); exit; } ######## END OF VALIDAZIONE ===NON=== PASSATA #### SE SONO QUI HO SUPERATO TUTTI I VINCOLI DI VALIDAZIONE writeTimeFile($idfile . "--Registry: HO SUPERATO I VINCOLI DI VALIDAZIONE"); ###################################################### ###### POSSO RIEMPIRE IL DATABASE DEL REGISTRY ####### writeTimeFile($idfile . "--Registry: Inizio a riempire il Database"); ### 1 - ExtrinsicObject include_once 'ExtrinsicObject_2.php'; $RETURN_from_ExtrinsicObject_id_array = fill_ExtrinsicObject_tables($dom_ebXML, $connessione); #### ARRAY DEGLI EXTRINSICOBJECTS ID $ExtrinsicObject_id_array = $RETURN_from_ExtrinsicObject_id_array[0]; $simbolic_ExtrinsicObject_id_array = $RETURN_from_ExtrinsicObject_id_array[3];
function fill_Association_tables($dom, $RegistryPackage_id_array, $ExtrinsicObject_id_array, $simbolic_RegistryPackage_FOL_id_array, $connessione) { writeTimeFile("Registry: sono entrato in fill_Association_tables"); ##### RADICE DEL DOCUMENTO ebXML $root_ebXML = $dom->document_element(); ##### ARRAY DEI NODI LeafRegistryObjectList $dom_ebXML_LeafRegistryObjectList_node_array = $root_ebXML->get_elements_by_tagname("LeafRegistryObjectList"); ##### NODO LeafRegistryObjectList $dom_ebXML_LeafRegistryObjectList_node = $dom_ebXML_LeafRegistryObjectList_node_array[0]; ##### TUTTI I NODI FIGLI DI LeafRegistryObjectList $dom_ebXML_LeafRegistryObjectList_child_nodes = $dom_ebXML_LeafRegistryObjectList_node->child_nodes(); for ($i = 0; $i < count($dom_ebXML_LeafRegistryObjectList_child_nodes); $i++) { #### SINGOLO NODO $dom_ebXML_LeafRegistryObjectList_child_node = $dom_ebXML_LeafRegistryObjectList_child_nodes[$i]; ##### tagname $dom_ebXML_LeafRegistryObjectList_child_node_tagname = $dom_ebXML_LeafRegistryObjectList_child_node->node_name(); #### SOLO I NODI ASSOCIATION if ($dom_ebXML_LeafRegistryObjectList_child_node_tagname == 'Association') { $association_node = $dom_ebXML_LeafRegistryObjectList_child_node; $DB_array_association_attributes = array(); $value_id = $association_node->get_attribute('id'); if ($value_id == '' || isSimbolic($value_id)) { $value_id = "urn:uuid:" . idrandom(); } #### PARENT $value_parent = $value_id; $value_accessControlPolicy = $association_node->get_attribute('accessControlPolicy'); if ($value_accessControlPolicy == '') { $value_accessControlPolicy = "NULL"; } $value_objectType = $association_node->get_attribute('objectType'); if ($value_objectType == '') { $value_objectType = "Association"; } $value_associationType = $association_node->get_attribute('associationType'); if ($value_associationType == '') { $value_associationType = "NOT DECLARED"; } $value_sourceObject = $association_node->get_attribute('sourceObject'); //writeSQLQuery('Valore fuori dall if '.$value_sourceObject); if ($value_sourceObject == "") { $errorcode[] = "XDSRegistryError"; $error_message[] = "The sourceObject in Association is empty. "; $folder_response = makeSoapedFailureResponse($error_message, $errorcode); writeTimeFile($_SESSION['idfile'] . "--Registry: targetObject error"); $file_input = $idfile . "-sourceObject_failure_response.xml"; writeTmpFiles($folder_response, $file_input, true); SendResponseFile($_SESSION['tmp_path'] . $file_input); //SendResponse($folder_response,"application/soap+xml",filesize($tmp_path.$idfile."-folder_failure_response.xml")); exit; } if (isSimbolic($value_sourceObject)) { $value_sourceObject_1 = $ExtrinsicObject_id_array[$value_sourceObject]; $value_sourceObject_2 = $RegistryPackage_id_array[$value_sourceObject]; if ($value_sourceObject_1 != "") { $value_sourceObject = $value_sourceObject_1; } else { $value_sourceObject = $value_sourceObject_2; } } //END OF if(isSimbolic($value_sourceObject)) $value_targetObject = $association_node->get_attribute('targetObject'); if ($value_targetObject == "") { $errorcode[] = "XDSRegistryError"; $error_message[] = "The targetObject in Association is empty. "; $folder_response = makeSoapedFailureResponse($error_message, $errorcode); writeTimeFile($_SESSION['idfile'] . "--Registry: targetObject error"); $file_input = $idfile . "-targetObject_failure_response.xml"; writeTmpFiles($folder_response, $file_input, true); SendResponseFile($_SESSION['tmp_path'] . $file_input); //SendResponse($folder_response,"application/soap+xml",filesize($tmp_path.$idfile."-folder_failure_response.xml")); exit; } $simbolic_value_targetObject = $association_node->get_attribute('targetObject'); if (isSimbolic($value_targetObject)) { $value_targetObject_1 = $ExtrinsicObject_id_array[$value_targetObject]; $value_targetObject_2 = $RegistryPackage_id_array[$value_targetObject]; if ($value_targetObject_1 != "") { $value_targetObject = $value_targetObject_1; } else { $value_targetObject = $value_targetObject_2; } } //END OF if(isSimbolic($simbolic_value_targetObject)) $value_isConfirmedBySourceOwner = $association_node->get_attribute('isConfirmedBySourceOwner'); if ($value_isConfirmedBySourceOwner == '') { $value_isConfirmedBySourceOwner = "0"; } $value_isConfirmedByTargetOwner = $association_node->get_attribute('isConfirmedByTargetOwner'); if ($value_isConfirmedByTargetOwner == '') { $value_isConfirmedByTargetOwner = "0"; } $DB_array_association_attributes['id'] = $value_id; $DB_array_association_attributes['accessControlPolicy'] = $value_accessControlPolicy; $DB_array_association_attributes['objectType'] = $value_objectType; $DB_array_association_attributes['associationType'] = $value_associationType; $DB_array_association_attributes['sourceObject'] = $value_sourceObject; $DB_array_association_attributes['targetObject'] = $value_targetObject; $DB_array_association_attributes['isConfirmedBySourceOwner'] = $value_isConfirmedBySourceOwner; $DB_array_association_attributes['isConfirmedByTargetOwner'] = $value_isConfirmedByTargetOwner; $Association_folder = in_array($simbolic_value_targetObject, $simbolic_RegistryPackage_FOL_id_array); if (!$Association_folder) { ####### QUI ORA POSSO RIEMPIRE IL DB $INSERT_INTO_Association = "INSERT INTO Association (id,accessControlPolicy,objectType,associationType,sourceObject,targetObject,isConfirmedBySourceOwner,isConfirmedByTargetOwner) VALUES ('" . $DB_array_association_attributes['id'] . "','" . $DB_array_association_attributes['accessControlPolicy'] . "','" . $DB_array_association_attributes['objectType'] . "','" . $DB_array_association_attributes['associationType'] . "','" . $DB_array_association_attributes['sourceObject'] . "','" . $DB_array_association_attributes['targetObject'] . "','" . $DB_array_association_attributes['isConfirmedBySourceOwner'] . "','" . $DB_array_association_attributes['isConfirmedByTargetOwner'] . "')"; $ris = query_exec2($INSERT_INTO_Association, $connessione); writeSQLQuery($ris . ": " . $INSERT_INTO_Association); #### NODI FIGLI DI ASSOCIATION $association_child_nodes = $association_node->child_nodes(); if (!empty($association_child_nodes)) { for ($j = 0; $j < count($association_child_nodes); $j++) { #### SINGOLO NODO $association_child_node = $association_child_nodes[$j]; ##### tagname $association_child_node_tagname = $association_child_node->node_name(); #### SOLO I NODI SLOT if ($association_child_node_tagname == 'Slot') { $slot_node = $association_child_node; $DB_array_slot_attributes = array(); $value_name = $slot_node->get_attribute('name'); if ($value_name == '') { $value_name = "NOT DECLARED"; } $value_slotType = $slot_node->get_attribute('slotType'); if ($value_slotType == '') { $value_slotType = "NULL"; } $DB_array_slot_attributes['name'] = $value_name; $DB_array_slot_attributes['slotType'] = $value_slotType; $DB_array_slot_attributes['value'] = ''; $DB_array_slot_attributes['parent'] = $value_parent; #### NODI FIGLI DI SLOT $slot_child_nodes = $slot_node->child_nodes(); for ($q = 0; $q < count($slot_child_nodes); $q++) { $slot_child_node = $slot_child_nodes[$q]; $slot_child_node_tagname = $slot_child_node->node_name(); if ($slot_child_node_tagname == 'ValueList') { $valuelist_node = $slot_child_node; $valuelist_child_nodes = $valuelist_node->child_nodes(); ## UN SOLO VALUE for ($r = 0; $r < count($valuelist_child_nodes); $r++) { $value_node = $valuelist_child_nodes[$r]; $value_node_tagname = $value_node->node_name(); if ($value_node_tagname == 'Value') { $value_value = $value_node->get_content(); $DB_array_slot_attributes['value'] = $value_value; ##### SONO PRONTO A SCRIVERE NEL DB $INSERT_INTO_Slot = "INSERT INTO Slot (name,slotType,value,parent) VALUES ('" . trim($DB_array_slot_attributes['name']) . "','" . trim($DB_array_slot_attributes['slotType']) . "','" . trim(adjustString($DB_array_slot_attributes['value'])) . "','" . trim($DB_array_slot_attributes['parent']) . "')"; $ris = query_exec2($INSERT_INTO_Slot, $connessione); writeSQLQuery($ris . ": " . $INSERT_INTO_Slot); } } } } } //END OF if($association_child_node_tagname=='Slot') } } //END OF if(!empty($association_child_nodes)) } else { } ########### CASI DI REPLACEMENT + ADDENDUM + TRANSFORMATION ##### CASO RPLC Accept Document Replace if ($value_associationType == "RPLC") { // devo verificare se il documento da sostituire è dentro ad un folder, se è dentro ad un folder devo creare una association Folder Document. $query_SELECT_RegistryPackage = "SELECT id from RegistryPackage where id IN (SELECT sourceObject from Association where targetObject = '{$value_targetObject}') and objectType = 'urn:uuid:d9d542f3-6cc4-48b6-8870-ea235fbc94c2'"; $Association_folder_array = query_select2($query_SELECT_RegistryPackage, $connessione); writeSQLQuery($Association_folder_array . ": " . $query_SELECT_RegistryPackage); //Se trovo qualche RegistryPackage di tipo folder $conta_Folder = count($Association_folder_array); for ($i_Folder = 0; $i_Folder < $conta_Folder; $i_Folder++) { $insert_Association_folderDoc = "INSERT INTO Association (id,objectType,associationType,sourceObject,targetObject) VALUES ('urn:uuid:" . idrandom() . "','Association','HasMember','" . $Association_folder_array[$i_Folder][0] . "','" . $value_sourceObject . "')"; $res_insert_Association = query_exec2($insert_Association_folderDoc, $connessione); writeSQLQuery($res_insert_Association . ": " . $insert_Association_folderDoc); } // devo cambiare lo stato del documento a Deprecated $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Deprecated' WHERE ExtrinsicObject.id = '{$value_targetObject}'"; $ex = query_exec2($query_UPDATE_targetObject, $connessione); writeSQLQuery($ex . ": " . $query_UPDATE_targetObject); } //END OF if($value_associationType=="RPLC") ##### CASO XFRM_RPLC Accept Document Replace with Transformation if ($value_associationType == "XFRM_RPLC") { $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Deprecated' WHERE ExtrinsicObject.id = '{$value_targetObject}'"; $ex = query_exec2($query_UPDATE_targetObject, $connessione); writeSQLQuery($ex . ": " . $query_UPDATE_targetObject); } //END OF if($value_associationType=="XFRM_RPLC") ##### CASO XFRM Accept Document Transformation if ($value_associationType == "XFRM") { $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Approved' WHERE ExtrinsicObject.id = '{$value_targetObject}'"; $ex = query_exec2($query_UPDATE_targetObject, $connessione); writeSQLQuery($ex . ": " . $query_UPDATE_targetObject); } //END OF if($value_associationType=="XFRM") ##### CASO APND Accept Document Addendum if ($value_associationType == "APND") { $query_UPDATE_targetObject = "UPDATE ExtrinsicObject SET status = 'Approved' WHERE ExtrinsicObject.id = '{$value_targetObject}'"; $ex = query_exec2($query_UPDATE_targetObject, $connessione); writeTimeFile("Registry: update status" . $query_UPDATE_targetObject); } //END OF if($value_associationType=="APND") ########### CASI DI GESTIONE FOLDER + SUBMISSIONSET if ($value_associationType == "HasMember") { ##### FIGLI DI ASSOCIATION $association_node_childs = $association_node->child_nodes(); #### AGGIUNTA DI UN DOCUMENTO A FOLDER GIA' ESISTENTE if (!isSimbolic($value_sourceObject) && empty($association_node_childs)) { #### APPURIAMO DI ESSERE NEL CASO FOLDER $query_folder = "SELECT * FROM Slot WHERE Slot.name = 'lastUpdateTime' AND Slot.parent = '{$value_sourceObject}'"; $ris_folder = query_select2($query_folder, $connessione); writeSQLQuery($ris_folder . ": " . $query_folder); if (!empty($ris_folder[0])) { #### ricavo data-ora correnti $today = date("Ymd"); $cur_hour = date("His"); $datetime = $today . $cur_hour; //$datetime = "CURRENT_TIMESTAMP"; ####UPDATE DI lastUpdateTime $update_lastUpdateTime = "UPDATE Slot SET Slot.value = '{$datetime}' WHERE Slot.name = 'lastUpdateTime' AND Slot.parent = '{$value_sourceObject}'"; $ex = query_exec2($update_lastUpdateTime, $connessione); writeSQLQuery($ex . ": " . $update_lastUpdateTime); } //END OF if(!empty($ris_folder)) } else { if (!isSimbolic($value_sourceObject) && !empty($association_node_childs)) { for ($y = 0; $y < count($association_node_childs); $y++) { ##### NODO SLOT $slot_node = $association_node_childs[$y]; ##### RECUPERO TAGNAME $slot_node_tagname = $slot_node->node_name(); if ($slot_node_tagname == "Slot") { #### NAME ATTRIBUTE FOR SLOT $slot_node_name = $slot_node->get_attribute('name'); #### NODI FIGLI DI SLOT $slot_node_childs = $slot_node->child_nodes(); for ($x = 0; $x < count($slot_node_childs); $x++) { $slot_node_child = $slot_node_childs[$x]; $slot_node_child_tagname = $slot_node_child->node_name(); if ($slot_node_child_tagname == "ValueList") { $slot_node_childs_2 = $slot_node_child->child_nodes(); for ($z = 0; $z < count($slot_node_childs_2); $z++) { $slot_node_child_2 = $slot_node_childs_2[$z]; $slot_node_child_2_tagname = $slot_node_child_2->node_name(); if ($slot_node_child_2_tagname == "Value") { $update_value = $slot_node_child_2->get_content(); } //END OF if($slot_node_child_2_tagname=="Value") } } //END OF if($slot_node_child_tagname=="ValueList") } ####UPDATE DI SubmissionSetStatus Non va fatta ????? Deve rimanere Approved $update_RegistryPackageStatus = "UPDATE RegistryPackage SET RegistryPackage.status = '{$update_value}' WHERE RegistryPackage.id = '{$value_sourceObject}'"; //writeSQLQuery($ris.": ".$update_RegistryPackageStatus); $selectIdAssociation = "SELECT id FROM Association WHERE Association.sourceObject = '{$value_sourceObject}'"; $ris_selectIdAssociation = query_select2($selectIdAssociation, $connessione); writeSQLQuery($ris_selectIdAssociation . ": " . $selectIdAssociation); $countID = count($ris_selectIdAssociation); for ($risId = 0; $risId < $countID; $risId++) { //$update_SubmissionSetStatus="UPDATE Slot SET Slot.value = '$update_value' WHERE name ='$slot_node_name' AND Slot.parent IN (SELECT id FROM Association WHERE Association.sourceObject = '$value_sourceObject')"; $update_SubmissionSetStatus = "UPDATE Slot SET Slot.value = '{$update_value}' WHERE name ='{$slot_node_name}' AND Slot.parent ='" . $ris_selectIdAssociation[$risId][0] . "'"; //writeTimeFile("Registry: update Slot ".$update_SubmissionSetStatus); $ex = query_exec2($update_SubmissionSetStatus, $connessione); writeSQLQuery($ex . ": " . $update_SubmissionSetStatus); } } //END OF if($slot_node_tagname=="Slot") } //END OF for($y=0;$y<count($association_node_childs);$y++) } } //END OF else if(!isSimbolic($value_sourceObject)) } //END OF if($value_associationType=="HasMember") } else { continue; } } //END OF for($i=0;$i<count($dom_ebXML_LeafRegistryObjectList_child_nodes);$i++) writeTimeFile("Registry: esco da fill_Association_tables"); }
function connectDB() { include './config/registry_oracle_db.php'; //putenv("ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0"); # open connection to db $conn = oci_connect($user_db, $password_db, $db); if (!$conn) { $errorcode = array(); $error_message = array(); $errorcode[] = "XDSRegistryError"; $err = ocierror(); $error_message[] = $err['message']; $database_error_response = makeSoapedFailureResponse($error_message, $errorcode); writeTimeFile($_SESSION['idfile'] . "--Registry: database_error_response"); $file_input = $_SESSION['idfile'] . "-database_error_response.xml"; writeTmpFiles($database_error_response, $file_input, true); SendResponseFile($_SESSION['tmp_path'] . $file_input); //SendResponse($database_error_response); exit; } return $conn; }
function isValid($ebxml_STRING_VALIDATION, $schema) { ####### VALIDAZIONE DELL'ebXML SECONDO LO SCHEMA libxml_use_internal_errors(true); $domEbxml = DOMDocument::loadXML($ebxml_STRING_VALIDATION); // Valido il messaggio da uno schema if (!$domEbxml->schemaValidate($schema)) { $errors = libxml_get_errors(); foreach ($errors as $error) { $errorcode[] = "XDSRegistryMetadataError"; $error_message[] = $error->message; } ### RESTITUISCE IL MESSAGGIO DI FAIL IN SOAP $failure_response = makeSoapedFailureResponse($error_message, $errorcode); ### SCRIVO LA RISPOSTA IN UN FILE // File da scrivere $file_input = $_SESSION['idfile'] . "-SOAPED_failure_VALIDATION_response.xml"; writeTmpFiles($failure_response, $file_input, true); SendResponseFile($_SESSION['tmp_path'] . $file_input); //SendResponse($failure_response); exit; } else { return true; } }
function connectDB() { # IMPORT MYSQL PARAMETERS (NOTE: IT WORKS WITH ABSOLUTE PATH ONLY !!) include './config/registry_mysql_db.php'; //ob_start();//OKKIO FONADAMENTALE!!!!!!!!!! # open connection to db $connessione = mysql_connect($ip_q, $user_db_q, $password_db_q); // or die("Connessione non riuscita: " . mysql_error()); if (!$connessione) { $errorcode = array(); $error_message = array(); $errorcode[] = "XDSRegistryError"; $error_message[] = mysql_error(); $database_error_response = makeSoapedFailureResponse($error_message, $errorcode); writeTimeFile($_SESSION['idfile'] . "--Registry: database_error_response"); $file_input = $_SESSION['idfile'] . "-database_error_response.xml"; writeTmpFiles($database_error_response, $file_input, true); SendResponseFile($_SESSION['tmp_path'] . $file_input); //SendResponse($database_error_response,"text/xml"); exit; } # open db //mysql_select_db($db_name_q); return $connessione; }
$SQLQuery_ESEGUITA = adjustQuery($SQLQuery); #### IMPORTANTE!!! ###SCRIVO LA QUERY CHE EFFETTIVAMENTE LANCIO A DB ###### ESEGUO LA QUERY $SQLResponse = query_select2($SQLQuery_ESEGUITA, $connessione); #################################################### #### CONTROLLO COME PRIMA COSA CHE LA SQL ABBIA RISULTATO if (empty($SQLResponse)) { #### STRINGA DI ERRORE $failure_response = "[EMPTY RESULT] - SQL QUERY[ " . avoidHtmlEntitiesInterpretation($SQLQuery) . " ] DID NOT GIVE ANY RESULTS IN THIS REGISTRY"; ### RESTITUISCE IL MESSAGGIO DI SUCCESS IN SOAP ### ANCHE SE IL RISULTATO DELLA QUERY DA DB È VUOTO $SOAPED_failure_response = makeSoapedSuccessQueryResponse($failure_response); $file_input = $idfile . "-SOAPED_NORESULTS_response.xml"; writeTmpQueryFiles($SOAPED_failure_response, $file_input, true); SendResponseFile($_SESSION['tmpQueryService_path'] . $file_input); //SendResponse($SOAPED_failure_response); exit; } //END OF if(empty($SQLResponse)) ####### QUI SONO SICURO CHE LE QUERY DA ALMENO UN RISULTATO $ebXML_Response_string = ""; $ebXML_Response_SOAPED_string = ""; ##### COMINCIO A COSTRUIRE L'ebXML DI RISPOSTA //$dom_ebXML_Response = domxml_new_doc("1.0");###documento //$dom_ebXML_Response_root = $dom_ebXML_Response->create_element("SQLQueryResult"); //$dom_ebXML_Response_root->set_namespace("urn:oasis:names:tc:ebxml-regrep:rim:xsd:2.1","rim"); //$dom_ebXML_Response_root = $dom_ebXML_Response->append_child($dom_ebXML_Response_root); ############### DISTINGUO I CASI A SECONDA DEGLI ATTRIBUTI ############### returnType E returnComposedObjects if ($returnType_a == "ObjectRef" && $returnComposedObjects_a == "false") {