/** * Prints the Response */ private function Send() { switch ($this->OutputMethod) { case Response::OT_JSON: header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Content-Type: application/json'); if (isset($_GET['jsonCallback'])) { echo $_GET["jsonCallback"] . "(" . json_encode(array_filter($this->Data, '\\Protocol\\ProcessDataElement')) . ")"; } else { echo json_encode(array_filter($this->Data, '\\Protocol\\ProcessDataElement')); } break; case Response::OT_XML: header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header("Content-Type: text/xml"); if (class_exists('XML_Serializer')) { $serializer = new XML_Serializer(); $serializer->serialize($this->Data); if (!PEAR::isError($status)) { echo $serializer->getSerializedOutput(); } else { throw new \Exception('Error in encoding XML output data'); } } else { throw new \Exception('Pear XML_Serializer package not found!'); } break; } }