How to connect to SSRS API with Custom Auth Extension

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://ift.tt/1n4r9k8


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