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 :

  • $theme = $_GET[‘theme’];
  • $soustheme = $_GET[‘soustheme’];
  • $lettre = $_GET[‘lettre’];
  • $id = $_GET[‘id’];
  • $wsdl = “https://: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);
  • ?>



Categories: BI Publisher

Tags: , ,

Leave a Reply

%d