
Untitled
By: a guest on
Jul 4th, 2012 | syntax:
None | size: 2.04 KB | hits: 20 | expires: Never
User auth problem when trying to access to the SQL Server Reporting service's webservice
public ReportGateway()
{
_rs = new ReportingService2005 { Credentials = new NetworkCredential(ConfigurationManager.AppSettings["ReportGatewayUser"], ConfigurationManager.AppSettings["ReportGatewayPassword"]) };
_rs.Url = "http://MyMachine:80/ReportServer/ReportService2005.asmx";//?? I saw when I was debugging that it wasn't reading the value in the app.config, but keeping the url of the reference when I created it, so for my test of the moment, I hard-setted it
_rsExec = new ReportExecution2005.ReportExecutionService { Credentials = new NetworkCredential(ConfigurationManager.AppSettings["ReportGatewayUser"], ConfigurationManager.AppSettings["ReportGatewayPassword"]) };
_rsExec.Url = "http://MyMachine:80/ReportServer/ReportExecution2005.asmx";//Same
GenerateReportList();
}
[MethodImpl(MethodImplOptions.Synchronized)]
private void GenerateReportList()
{
try
{
Dictionary<String, SRSSReport> reports = new Dictionary<String, SRSSReport>();
foreach (var children in _rs.ListChildren("/", true))
{
if (children.Type == ItemTypeEnum.Report)
{
SRSSReport report = new SRSSReport {Name = children.Name, Path = children.Path};
ReportParameter[] parameters = _rs.GetReportParameters(children.Path, null, false, null, null);
foreach (ReportParameter parameter in parameters)
report.Parameters.Add(new SRSSReportParameter {Name = parameter.Name, Type = _typeConverstion[parameter.Type]});
reports.Add(report.Path, report);
}
}
lock (_lockObject)
{
_reports = reports;
}
}catch(Exception ex)
{
_reports = new Dictionary<string, SRSSReport>();
Logger.Instance.Error("Error when contacting the reporting server", ex);
}
}