Jump to content

Call Jasper Report from PHP


jagath.ath

Recommended Posts

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 JaspersoftClientClient;

 

$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;

?>

 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

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.

Link to comment
Share on other sites

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:394nStack 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
 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...