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);
  • ?>



Catégories :BI Publisher

Tags:, ,

1 réponse

  1. A question was sent to me: how to call the report with multiple parameters. Below is the snippet of the code to change to improve to be able to do this:

    ParamNameValue = new stdClass();
    $ParamNameValue->name = ‘PARAM1′;
    $ParamNameValue->multiValuesAllowed = false;
    $ParamNameValue->refreshParamOnChange = false;
    $ParamNameValue->selectAll = true;
    $ParamNameValue->templateParam = false;
    $ParamNameValue->useNullForAll = false;
    $value= new stdClass();
    $value->item=’VALUE OF PARAM1’;

    $ParamNameValue->values = $value;
    $ParamNameValue2= new stdClass();
    $ParamNameValue2->name = ‘PARAM2′;
    $ParamNameValue2->multiValuesAllowed = false;
    $ParamNameValue2->refreshParamOnChange = false;
    $ParamNameValue2->selectAll = true;
    $ParamNameValue2->templateParam = false;
    $ParamNameValue2->useNullForAll = false;
    $values= new stdClass();
    $values->item=’VALUE OF PARAM2’;

    $ParamNameValue2->values = $values;
    $ArrayOfParamNameValue = new stdClass();
    $ArrayOfParamNameValue->item=array($ParamNameValue,$ParamNameValue2);

    You can continue like this with more parameters.

Laisser un commentaire

En savoir plus sur Nomana-IT

Abonnez-vous pour poursuivre la lecture et avoir accès à l’ensemble des archives.

Continue reading