Start a new topic

UPDATE : Call BI Publisher from PHP to run a report and get a PDF

The previous topic was explaining how to call BI Publisher with the first version of the API. This second version contains more parameters :


<?php



$theme = $_GET['theme'];

$soustheme = $_GET['soustheme'];

$lettre = $_GET['lettre'];

$id = $_GET['id'];


$wsdl = "https://<BI_PUBLISHER_SERVER>:PORT/xmlpserver/services/v2/ReportService?wsdl";

$client = new SoapClient($wsdl);


$ParamNameValue = new stdClass();

$ParamNameValue->name = 'IDENTIFIANT';

$ParamNameValue->multiValuesAllowed = false;

$ParamNameValue->refreshParamOnChange = false;

$ParamNameValue->selectAll = false;

$ParamNameValue->templateParam = false;

$ParamNameValue->useNullForAll = false;

$ParamNameValue->values = array($id);


$ArrayOfParamNameValue = new stdClass();

$ArrayOfParamNameValue->item = $ParamNameValue;


$ParamNameValues = new stdClass();

$ParamNameValues->listOfParamNameValues = $ArrayOfParamNameValue;


$reportRequest = new stdClass();

$reportRequest->attributeFormat = 'pdf';

$reportRequest->attributeLocale = "fr-FR";

$reportRequest->attributeTemplate = $theme . '_' . $soustheme . '_' . $lettre;

$reportRequest->byPassCache = true;

$reportRequest->flattenXML = false;

$reportRequest->sizeOfDataChunkDownload = -1;

$reportRequest->reportAbsolutePath = 'LETTRETYPE/' . $theme . '/' . $soustheme . '/' . $lettre . '.xdo';

$reportRequest->XDOPropertyList = '';

$reportRequest->attributeCalendar = '';

$reportRequest->attributeTimezone = '';

$reportRequest->attributeUILocale = '';

$reportRequest->parameterNameValues = $ParamNameValues;

$reportRequest->reportData = '';

$reportRequest->reportOutputPath = '';

$reportRequest->reportRawData = '';

//var_dump($reportRequest);


$report = $client->runReport(array('reportRequest'=>$reportRequest,'userID'=>'USER','password'=>'PASSWORD'));


header('Content-type: application/pdf');

echo $report->runReportReturn->reportBytes;

//var_dump($report);

?>



Dear Franck Blettner!


how to get the report in XML format?

Hello Elchi,


It depends of what you want. If you want an output in XML format, you should use an XSL template and not an RTF template. The attribute format should be then set to XML :

$reportRequest->attributeFormat = 'xml';


Franck


Login or Signup to post a comment