Pass php parameter to JasperReports

1

I have a parameter java.util.Collection called parameters and my example query would be like this:
SELECT nombre FROM persona WHERE $X{IN, id, parametros} .

My question is how do I pass the parameter from php?

I used this function to pass values to parameters of type java.lang.Integer which works correctly for me. But not for parameters of type java.util.Collection

///

$reportParams = array('parametro' => 123);

$cliente->printReport($jasperPath, $reportName, $reportFormat, $reportParams);

//


public function printReport($reportPath, $reportName, $outputFormat = "HTML", $parameterArray = array()) 
{

    $this->_reportPath = $reportPath;
    $this->_reportName = $reportName;
    $this->_outputFormat = $outputFormat;
    $this->_parameterArray = $parameterArray;

    $requestXML = "<request operationName=\"runReport\">";
    $requestXML .= "<argument name=\"RUN_OUTPUT_FORMAT\">$outputFormat</argument>";
    $requestXML .= "<resourceDescriptor name=\"\" wsType=\"reportUnit\" uriString=\"$reportPath$reportName\" isNew=\"false\">";
    $requestXML .= "<label></label>";
    foreach ($parameterArray as $key => $value) {
        $requestXML .= "<parameter name=\"$key\"><![CDATA[$value]]></parameter>";
    }
    $requestXML .= "</resourceDescriptor></request>";
    //echo $requestXML, "\n\n";

    try {
        $this->_soapClient->runReport($requestXML);
        $reportOutput = $this->parseResponseWithReportData(
                $this->_soapClient->__getLastResponseHeaders(), $this->_soapClient->__getLastResponse(), $outputFormat
        );
    } catch (\SoapFault $e) {
        if ($e->faultstring == 'looks like we got no XML document') {
            $reportOutput = $this->parseResponseWithReportData(
                    $this->_soapClient->__getLastResponseHeaders(), $this->_soapClient->__getLastResponse(), $outputFormat
            );
        } else {
            throw new \Exception("Error Creating Report " . $e->faultstring);
        }
    }
    return $reportOutput;
}
    
asked by josue chavarria 04.12.2018 в 15:54
source

0 answers