Jump to content
Changes to the Jaspersoft community edition download ×

Passing input parameters in php rest_v2 client array returns only the first value of the array


bartv2000

Recommended Posts

Hi,

When I run a report from my php application with one parameter it works fine.
But when passing more than one parameter, only the first one in the array is passed to the report.
When changing the input parameters in the php array, then still the first one is passed to the report.
All the individual parameters are working like they should in the report when I pass them.

This is my php code:

$controls = array("REPORT_LOCALE" => array("NL_BE"),"Parameter1" => array("Param1"),"CMS_USER_ID" => array("123"));                  
$report = $client->runReport('/reports/VZVB/License_List_1_NL', 'pdf', null, $controls);
 
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename=report.pdf');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . strlen($report));
header('Content-Type: application/pdf');
echo $report;
 
In this example only the "REPORT_LOCALE" parameter is passed to the report. All the others return null in the report.
I tried somewhat everything (single quotes, double quotes, ...)
Thanks for any help. 
 
Regards
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Hi, it seems that you are using an old version of the PHP client. I would suggest checking out the latest version on Github and reading the provided documentation. It is very likely that this was a previous bug that has been taken care of by the latest version of the client.

 

You can obtain the latest version of the PHP client from the Releases page of the community site, or you can visit Github: http://github.com/Jaspersoft/jrs-rest-php-client

Link to comment
Share on other sites

Hi grantbacon,

 

I tried the new client but I did not get it working yet...

But I found the problem with the old client.

The parameters in the webservice call where badly formatted with & in the url query. I changed the "http_build_query(array('page' => $page) + (array) $inputControls))" function call in the runReport function into "http_build_query((array('page' => $page) + (array) $inputControls), '', '&'));" and now it is nicely formatted. Some webservers ignore the amp; in the url query but seems that tomcat servers have problems with it.

 

Thanks for your help!

 

Regards

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...