Example #1
0
 public function run($reportName, $formatType = 'PDF', $reportParams = null, $saveFile = false)
 {
     $client = new \SoapClient($this->jasperServer->getWsdl(), array('login' => $this->jasperServer->getUsername(), 'password' => $this->jasperServer->getPassword(), "trace" => 1, "exceptions" => 0));
     $client->runReport($this->_requestMock($reportName, $formatType, $reportParams));
     preg_match('/boundary="(.*?)"/', $client->__getLastResponseHeaders(), $gotcha);
     $bound = $gotcha[1];
     $invokeReturnPart = explode($bound, $client->__getLastResponse());
     $output = substr($invokeReturnPart[2], strpos($invokeReturnPart[2], '<report>') + 9);
     $content = trim(str_replace("\n--", "", $output));
     if ($saveFile === true) {
         $filename = $this->jasperServer->getPathToSave() . DIRECTORY_SEPARATOR . 'generate_report_at_' . time() . ".{$formatType}";
         file_put_contents($filename, $content);
         return $filename;
     } else {
         return $content;
     }
 }
Example #2
0
 function runReport($uri, $parameters = array(), $arguments = array())
 {
     $descr = new JasperResourceDescriptor('', '', $uri);
     $descr->parameters = $parameters;
     $req = new JasperRequest('runReport');
     $req->descriptor = $descr;
     $response = new JasperResponse(parent::runReport($req));
     $response->attachments = $this->attachments;
     return $response;
 }