Lyleyboy Posted July 19, 2010 Share Posted July 19, 2010 Hi all, I have a problem with trying to render a report from MS SQL Server Reporting services using PHP. I have happliy get the report to display in HTML or PDF but I really need it to be in Excel. When I set it to export to excel it does open a document but it is filled with rubbish. My code <?php ini_set("soap.wsdl_cache_enabled", "0"); ini_set("default_socket_timeout", "120"); set_time_limit(120); DEFINE('Cache', 'NULL'); DEFINE('CSV', 'CSV'); DEFINE('Excel', 'EXCEL'); DEFINE('HTML', 'HTML4.0'); DEFINE('PDF', 'PDF'); DEFINE('TIFF', 'IMAGE'); DEFINE('WebArchive', 'MHTML'); DEFINE('XML', 'XML'); $report = "/REPORT GOES HERE"; $format = "HTML4.0"; $devInfo = "<DeviceInfo><Toolbar>True</Toolbar><Parameters>True</Parameters></DeviceInfo>"; $result = array(); $extension = ""; $mimeType = ""; $encoding = ""; $warnings = array(); $streamIDs = array(); $historyID = null; $paramLang = "en-us"; $namespace = "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices"; $serviceEndPt = "http://192.168.xxx.xxx/reportserver/ReportService.asmx?wsdl"; $executionEndPt = "http://192.168.xxx.xxx/reportserver/ReportExecution2005.asmx?wsdl"; try { $execclient = new SoapClient($executionEndPt, array('login'=>"username", 'password'=>"password")); $loadReportParam = array( 'Report' => $report, 'snapshotID' => $historyID ); $execInfo = $execclient -> LoadReport($loadReportParam); $executionID = $execInfo->executionInfo->ExecutionID; $setExecParam = array('ExecutionID' => $executionID); $execHeader = new SoapHeader ( $namespace, 'ExecutionHeader', $setExecParam ); $execclient->__setSoapHeaders($execHeader); $reportParams = array ( array('Name' => 'dtStartDate', 'Value' => "2010/01/01", 'Label' => NULL), array('Name' => 'dtEndDate', 'Value' => "2010/06/06", 'Label' => NULL), array('Name' => 'nvcClient', 'Value' => "DETAIL", 'Label' => NULL) ); $sepResult = $execclient->SetExecutionParameters(array("Parameters"=>$reportParams), $paramLang); if ($debug) varDump ('SetExecutionParameters',$sepResult); $renderParams = array ( 'Format' => $format, 'DeviceInfo' => $devInfo ); $rrResult = $execclient -> Render($renderParams); header('Content-Type:'.$rrResult->MimeType); echo $rrResult->Result; } catch (SoapFault $e) { var_dump($e); } ?> I have obliterated certain bits a detail for security purposes. Does anyone know what I'm doing wrong? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/208159-help-with-rendering-mssrs-reporting-services/ Share on other sites More sharing options...
Kevin.Arvixe Posted July 19, 2010 Share Posted July 19, 2010 Im just going to throw this out there because you havent gotten any replies... MSSRS is not generally used w/ PHP. I think this is more of a question about MSSRS's SOAP API, which may be better suited for the MS forums. Quote Link to comment https://forums.phpfreaks.com/topic/208159-help-with-rendering-mssrs-reporting-services/#findComment-1088203 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.