FALSE, 'message' => 'Empty result', ); } $doc = new DOMDocument(); if (!$doc->loadXML($result)) { return array( 'success' => FALSE, 'message' => 'Result is not in XML format', ); } $nodes = $doc->getElementsByTagName('LocalDataBaseParameters'); if ($nodes->length == 0) { return array( 'success' => FALSE, 'message' => 'Cannot retrieve LocalDataBaseParameters node', ); } $xml_url = $nodes->item(0)->nodeValue; if (empty($xml_url)) { return array( 'success' => FALSE, 'message' => 'Cannot retrieve XML file path', ); } return $this->checkObsDataTree($xml_url); } protected function checkSOAPResult($result) { if (empty($result)) { return array( 'success' => FALSE, 'message' => 'Empty result', ); } if (empty($result->success)) { return array( 'success' => FALSE, 'message' => 'Error in request', ); } if (empty($result->WorkSpace) || empty($result->WorkSpace->LocalDataBaseParameters)) { return array( 'success' => FALSE, 'message' => 'Cannot retrieve XML file path', ); } return $this->checkObsDataTree($result->WorkSpace->LocalDataBaseParameters); } private function checkObsDataTree($xml_path) { $data = file_get_contents($xml_path); if (!$data) { return array( 'success' => FALSE, 'message' => 'Cannot load tree XML file', ); } $doc = new DOMDocument(); if (!@$doc->loadXML($data)) { return array( 'success' => FALSE, 'message' => 'Local tree is not in XML format', ); } if ($doc->documentElement->nodeName != 'dataRoot') { return array( 'success' => FALSE, 'message' => 'Cannot retrieve dataRoot node in tree file', ); } return array( 'success' => TRUE, ); } } ?>