daniel.la Posted July 25, 2017 Share Posted July 25, 2017 I'm using JasperSoft Studio Community Edition (6.3.1 final) and have the Community edition of JasperServer.I have created reports and successfully published them from Studio to the server. I've also been able to review the reports on the actual server itself through the web app.My next step is to use the Rest v2 API to display my reports in a project but I've been unsuccessful.Here is my code (trying to display the server info):<?php require_once("autoload.dist.php"); use JaspersoftClientClient; $c = new Client("my-server-ip", "my-username", "my-password"); $info = $c->serverInfo(); printf($info); ?>[/code]I removed the organization because there is no organization associated with my account and having the organization parameter would return a 404 error.Upon testing this code, I receive the following message:Fatal error: Uncaught exception 'JaspersoftExceptionRESTRequestException' with message 'An unexpected HTTP status code was returned by the server' in /var/www/html/jaspersoft-php/src/Jaspersoft/Tool/RESTRequest.php:378 Stack trace: #0 /var/www/html/jaspersoft-php/src/Jaspersoft/Tool/RESTRequest.php(451): JaspersoftToolRESTRequest->handleError(0, Array, false) #1 /var/www/html/jaspersoft-php/src/Jaspersoft/Client/Client.php(158): JaspersoftToolRESTRequest->prepAndSend('http://my-ip...', Array, 'GET', NULL, true, 'application/jso...', 'application/jso...') #2 /var/www/html/jaspersoft-php/index.php(22): JaspersoftClientClient->serverInfo() #3 {main} thrown in /var/www/html/jaspersoft-php/src/Jaspersoft/Tool/RESTRequest.php on line 378 Does anyone have any ideas as to why this is happening? I've been stuck on this issue for a day now and would like to get to the bottom of it.Thank you in advance! Link to comment Share on other sites More sharing options...
daniel.la Posted July 25, 2017 Author Share Posted July 25, 2017 nevermind. solved it Link to comment Share on other sites More sharing options...
germanmary.p Posted August 24, 2017 Share Posted August 24, 2017 Please tell me how to resolve this issue;Fatal error: Uncaught exception 'JaspersoftExceptionRESTRequestException' with message 'An unexpected HTTP status code was returned by the server' in C:xampphtdocssamplesrcJaspersoftToolRESTRequest.php:378 Stack trace: #0 C:xampphtdocssamplesrcJaspersoftToolRESTRequest.php(451): JaspersoftToolRESTRequest->handleError(0, Array, false) #1 C:xampphtdocssamplesrcJaspersoftClientClient.php(158): JaspersoftToolRESTRequest->prepAndSend('http://192.168....', Array, 'GET', NULL, true, 'application/jso...', 'application/jso...') #2 C:xampphtdocssamplesample.php(15): JaspersoftClientClient->serverInfo() #3 {main} thrown in C:xampphtdocssamplesrcJaspersoftToolRESTRequest.php on line 378 Link to comment Share on other sites More sharing options...
daniel.la Posted August 24, 2017 Author Share Posted August 24, 2017 It seems like you're developing locally. Can you test this on a live server? I had the same issues when developing locally, none of my reports would display. Link to comment Share on other sites More sharing options...
germanmary.p Posted August 25, 2017 Share Posted August 25, 2017 i am new to this i dont undertstand how to do it . i have created the report and tried in server .i used this code with php client jrs-rest-php-client-2.0.0 after downloading i had written a php file and run through xampp . <?php/*ini_set('display_errors',1);ini_set('display_startup_errors',1);error_reporting(E_ALL);*///require_once __DIR__ . "/autoload.dist.php"; require_once("autoload.dist.php");use JaspersoftClientClient; //require_once "src/Jaspersoft/Client/Client.php";/* try { */ $d = new Client( "http://localhost:8080/jasperserver", "jasperadmin", "jasperadmin" ,"" ); $info = $d->serverInfo(); printf($info);/*} catch (RESTRequestException $e) { echo 'RESTRequestException:'; echo 'Exception message: ', $e->getMessage(), "n"; echo 'Set parameters: ', $e->parameters, "n"; echo 'Expected status code:', $e->expectedStatusCodes, "n"; echo 'Error code: ', $e->errorCode, "n";} $conts=array("agtid"=>2);$report = $c->reportService()->runReport('/reports/samples/Cascading_multi_select_report',"pdf",null,null,$conts);*///echo $report;?> Link to comment Share on other sites More sharing options...
sterlingman2001 Posted December 14, 2017 Share Posted December 14, 2017 I have the same error. Is there anyone who can suggest something to solve this issue ? Thanks. Link to comment Share on other sites More sharing options...
polexito2002_1 Posted October 22, 2018 Share Posted October 22, 2018 It's a pity that the jasperserver community could not find a solution! I just want to connect php7 with jasperserver7, use httpd in linux centos 7 (64bits). I'm showing the same error. Any light will be welcome Link to comment Share on other sites More sharing options...
thomas.frommelt Posted December 13, 2018 Share Posted December 13, 2018 Use User: jasperadmin and Password: jasperadminI don't no why but only this user works. Link to comment Share on other sites More sharing options...
vspadma01 Posted March 30, 2022 Share Posted March 30, 2022 Hi ,What is the solution for this problem? Facing this issue for one report when trying to run the report using one of the parameter.Received following message:RESTRequestException:Exception message: An unexpected HTTP status code was returned by the server Set parameters: Expected status code:Array Error code: Array ( [0] => 200 ) JaspersoftExceptionRESTRequestException Object ( [message] => An unexpected HTTP status code was returned by the server [expectedStatusCodes] => Array ( [0] => 200 ) [statusCode] => 0 [jrsMessage] => [errorCode] => [parameters] => [string:Exception:private] => [code:protected] => 0 [file:protected] => C:xampphtdocslspsitelocalreportsjrs-rest-php-client-mastersrcJaspersoftToolRESTRequest.php [line:protected] => 409 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:xampphtdocslspsitelocalreportsjrs-rest-php-client-mastersrcJaspersoftToolRESTRequest.php [line] => 479 [function] => handleError [class] => JaspersoftToolRESTRequest [type] => -> [args] => Array ( [0] => 0 [1] => Array ( [0] => 200 ) [2] => ) ) [1] => Array ( [file] => C:xampphtdocslspsitelocalreportsjrs-rest-php-client-mastersrcJaspersoftServiceReportService.php [line] => 40 [function] => prepAndSend [class] => JaspersoftToolRESTRequest [type] => -> [args] => Array ( [0] => http://localhost:8080/jasperserver/rest_v2/reports/ContentFiles/html/TeacherPerformanceReport.html?interactive=true&onePagePerSheet=true&freshData=true&saveDataSnapshot=false&trackId=1 [1] => Array ( [0] => 200 ) [2] => GET [3] => [4] => 1 ) ) [2] => Array ( [file] => C:xampphtdocslspsitelocalreportsteacherperformancereport.php [line] => 146 [function] => runReport [class] => JaspersoftServiceReportService [type] => -> [args] => Array ( [0] => /ContentFiles/html/TeacherPerformanceReport [1] => html [2] => [3] => [4] => Array ( [trackId] => Array ( [0] => 1 ) ) [5] => 1 [6] => 1 ) ) ) [previous:Exception:private] => )Report run successfully for other parameters.Kindly help. Thanks in Advance Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now