Call Jasper Report from PHP

0
I have setup Jasper Report server(Community Edition) on AWS. When I Call a report from PHP page, no report coming.
 
What can be the issues. Is some component missing?
 
Thanks.
 
// $start = microtime(true);
require_once __DIR__ . "/autoload.dist_org.php";
 
use Jaspersoft\Client\Client;
 
$c = new Client("http://localhost:8080/jasperserver", "jasperadmin", "jasperadmin");
$options = array('month_h' => $this->month, 'year_h' => $this->year, 'user_h' => $this->territory);
$report = $c->reportService()->runReport('/reports/CBLWAY_REPORTS/HELPDESK/HD_User_Summary_Report_03_27', 'html', null, null, $options);
 
echo $report;
// $time_elapsed_us = microtime(true) - $start;
// echo $time_elapsed_us;
?>
 
jagath.ath's picture
Joined: Jul 6 2015 - 9:48pm
Last seen: 4 years 4 months ago

2 Answers:

-1

I see your code calls the server as "http://localhost:8080/jasperserver" make sure your EC2 instace in AWS is answering correctly on port 8080 and the security groups allow that connection.

Also I assume you are not really using "localhost" but the proper EC2 Public DNS Name.

marianol's picture
4818
Joined: Sep 13 2011 - 8:04am
Last seen: 1 year 2 months ago
0

Thanks your reply Marianol.

And i have replase the localhost with the both Private IP and Elastic IP but the same error.

I have check /var/log/httpd error_log

ith message 'An unexpected HTTP status code was returned by the server' in /var/www/html/CBLWAY/views/reports/src_lib/Jaspersoft/Tool/RESTRequest.php:394\nStack trace:\n#0 /var/www/html/CBLWAY/views/reports/src_lib/Jaspersoft/Tool/RESTRequest.php(464): Jaspersoft\\Tool\\RESTRequest->handleError(0, Array, false)\n#1 /var/www/html/CBLWAY/views/reports/src_lib/Jaspersoft/Service/ReportService.php(40): Jaspersoft\\Tool\\RESTRequest->prepAndSend('http://localhos...', Array, 'GET', NULL, true)\n#2 /var/www/html/CBLWAY/views/reports/report7.php(20): Jaspersoft\\Service\\ReportService->runReport('/reports/HD_Are...', 'html', NULL, NULL, Array)\n#3 /var/www/html/CBLWAY/lib/view.php(6): require('/var/www/html/C...')\n#4 /var/www/html/CBLWAY/controllers/reportscontroller.php(165): View->RenderView('reports/report7')\n#5 /var/www/html/CBLWAY/index.php(26): ReportsController->Rep7_View(Array)\n#6 {main}\n  thrown in /var/www/html/CBLWAY/views/reports/src_lib/Jaspersoft/Tool/RESTRequest.php on line 394, referer: http://52.24.241.133/CBLWAY/index.php?controller=reports&action=report7
 

 

jagath.ath's picture
Joined: Jul 6 2015 - 9:48pm
Last seen: 4 years 4 months ago
Feedback
randomness