Cannot connect to SSRS in PHP

I am using SSRS SDK for PHP

PHP version 5.4

webserver: Centos 6.4

MSSQL Server 2008 R2

define("UID", "*****\*****");
define("PASWD", "*****");
define("SERVICE_URL", "http://192.168.0.1/ReportServerURL/");
try {
  $ssrs_report = new SSRSReport(new Credentials(UID, PASWD), SERVICE_URL);
} catch (SSRSReportException $serviceException) {
  echo $serviceException->GetErrorMessage() . "<br>";
}

When I try to connect an SSRS report, it executes the following error:

Failed to connect to Reporting Service Make sure that the url (http://192.168.0.1/ReportServerURL/) and credentials are correct!

The same credentials and link are accessible through the browser without problems. But through SSRS SDK it does not work.

I searched the solution online and I found that using the file TestSSRSConnection.php, I could get more detailed information, but I don’t know how to use it, and I can’t find the documentation about it.

$testSSRSConnection = new TestSSRSConnection("/192.168.0.1/TESTREPORT/ReportServerURL/*****\*****/*****");
$testSSRSConnection->Parse();
$testSSRSConnection->TestConnection();

When testing, I get the following error:

Usage:TestSSRSConnection.php /server: /report: /uid: /pwd: [/datasource: /uid: /pwd:] 

Some ideas on how to move forward in this section?

Update Executionvar_export($http_response_header))

I got

array (
      0 => 'HTTP/1.1 401 Unauthorized',
      1 => 'Content-Length: 0',
      2 => 'WWW-Authenticate: Negotiate',
      3 => 'WWW-Authenticate: NTLM',
      4 => 'Date: Tue, 04 Mar 2014 22:13:58 GMT',
      5 => 'Connection: close',
)
+4
source share
2

.

Reporting Services , NTLM. , , .

, SSRSReport.php 193

if ($content === FALSE) {
  throw new SSRSReportException("", "<br>Failed to connect to Reporting Service  <br/> Make sure   " .
  "that the url ($this->_BaseUrl) and credentials are correct!<br>" .
  var_export($http_response_header));//Line added by me to get the http header response
}

:

array (
   0 => 'HTTP/1.1 401 Unauthorized',
   1 => 'Content-Length: 0',
   2 => 'WWW-Authenticate: Negotiate',
   3 => 'WWW-Authenticate: NTLM',
   4 => 'Date: Tue, 04 Mar 2014 22:13:58 GMT',
   5 => 'Connection: close',
)

Failed to connect to Reporting Service
Make sure that the url (http://192.168.0.1/ReportServerURL/) and credentials are correct!

SSRS .

1- RSReportServer.config .

2- Authentication.

3- XML, . XML , :

<Authentication>
    <AuthenticationTypes>
         <RSWindowsBasic>
               <LogonMethod>3</LogonMethod>
               <Realm></Realm>
               <DefaultDomain></DefaultDomain>
         </RSWindowsBasic>
    </AuthenticationTypes>
    <EnableAuthPersistence>true</EnableAuthPersistence>
</Authentication>

, :

    <AuthenticationTypes>
         <RSWindowsBasic/>
    </AuthenticationTypes>

4 .

, RSWindowsBasic, RSWindowsNegotiate, RSWindowsNTLM RSWindowsKerberos.

Safari, . RSWindowsBasic .

, Custom .

5 , .

6- .

7- , .

8- , , .

+5

, SDK , , , :

define("UID", "*****\*****");

Windows, , :

define("UID", "domain\nick");

echo UID;

domain
nick

\n ; :

define("UID", "domain\\nick"); // backslash is escaped
echo UID; // output: domain\nick

SSRSReport.php ( 168) :

$stream_conext_params = array('http' => array(
    'header' => array($credentials->getBase64Auth())
));

header , :

$stream_conext_params = array('http' => array(
    'header' => $credentials->getBase64Auth(),
));
+3

Source: https://habr.com/ru/post/1529501/


All Articles