2
votes

I previously had set up an application to connect to SSRS with ReportExecutionServiceSoapClient and run reports, but since implementing the custom security extension I can no longer connect. Here is what I have been trying. I keep getting 500 errors. I can log into the report manager fine, but the API doesn't work.

ReportExecution.ReportExecutionServiceSoapClient rsExec = new ReportExecution.ReportExecutionServiceSoapClient();

        rsExec.ClientCredentials.UserName.UserName = "username";
        rsExec.ClientCredentials.UserName.Password = "password";
        byte[] results = null;
        TrustedUserHeader trusteduserHeader = new TrustedUserHeader();
        ExecutionInfo execInfo = new ExecutionInfo();
        ExecutionHeader execHeader = new ExecutionHeader();

        // Load the report
        string reportPath = selReport.Path;
        string historyID = null;
        ServerInfoHeader serviceInfo = new ServerInfoHeader();
        rsExec.LoadReport(trusteduserHeader, reportPath, historyID, out serviceInfo, out execInfo);

Here is my Web.config

  <system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="ReportingService2010Soap" />
    <binding name="ReportExecutionServiceSoap" />
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="REMOVED/ReportServer/ReportExecution2005.asmx"
    binding="basicHttpBinding" bindingConfiguration="ReportExecutionServiceSoap"
    contract="ReportExecution.ReportExecutionServiceSoap" name="ReportExecutionServiceSoap" />
  <endpoint address="REMOVED/ReportServer/ReportService2010.asmx"
    binding="basicHttpBinding" bindingConfiguration="ReportingService2010Soap"
    contract="ReportService.ReportingService2010Soap" name="ReportingService2010Soap" />
</client>

"{"The remote server returned an error: (500) Internal Server Error."}"

This error happens on the loadreport call. The only thing that changed that stopped it from working is the authentication. I added the two lines with username and password and removed these lines

  rsExec.ClientCredentials.Windows.ClientCredential = (System.Net.NetworkCredential)System.Net.CredentialCache.DefaultCredentials;
        rsExec.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

Can you not connect to the API with custom auth??This is how I changed SSRS to do custom auth http://www.codeproject.com/Articles/675943/SSRS-Forms-Authentication

Any help would be greatly appreciated. I keep coming up short Googling around.

1
did you try LogonUser?liuhongbo
Have you ever solved this? I am having a similar issue.Martijn

1 Answers

0
votes

This worked for me:

System.Net.NetworkCredential clientCredentials = new System.Net.NetworkCredential(ReportServerUserName, ReportServerPassword);
rsExec.Credentials = clientCredentials;