예제 #1
0
 /**     
  * Default constructor for ReportExecutionService.
  * @param Credential $credentials Object holding user credentials.
  * @param string $url Url of Report Server.
  */
 public function SSRSReport($credentials, $url, $proxy = null)
 {
     $this->_BaseUrl = $url[strlen($url) - 1] == '/' ? $url : $url . '/';
     $executionServiceUrl = $this->_BaseUrl . self::ExecutionService;
     $managementServiceUrl = $this->_BaseUrl . self::ManagementService;
     $options = $credentials->getCredentails();
     $stream_conext_params = array('http' => array('header' => array($credentials->getBase64Auth())));
     if (isset($proxy)) {
         $options = array_merge($options, $proxy->getProxy());
         $stream_conext_params['http']['proxy'] = 'tcp://' . $proxy->getHost() . ':' . $proxy->getPort();
         if ($proxy->getLogin() != null) {
             $stream_conext_params['http']['header'][1] = $proxy->getBase64Auth();
         }
     }
     /**
      * If the SoapClient call fails, we cannot catch exception or supress warning
      * since it throws php fatal exception.
      * http://bugs.php.net/bug.php?id=34657
      * So try to load the wsdl by
      * calling file_get_contents (with warning supressed i.e. using @ symbol
      * infront of the function call)
      * http://stackoverflow.com/questions/272361/how-can-i-handle-the-warning-of-filegetcontents-function-in-php
      */
     $context = stream_context_create($stream_conext_params);
     $content = @file_get_contents($executionServiceUrl, false, $context);
     if ($content === FALSE) {
         throw new SSRSReportException("", "Failed to connect to Reporting Service  <br/> Make sure " . "that the url ({$this->_BaseUrl}) and credentials are correct!");
     }
     $this->_soapHandle_Exe = new SoapClient($executionServiceUrl, $options);
     $this->_soapHandle_Mgt = new SoapClient($managementServiceUrl, $options);
     $this->ClearRequest();
 }