Problem with ReportServer2010.asmx and SharePoint RRS feed

  • Question

  • Hi everybody,

    I installed SSRS 2008R2 integrated with SharePoint Foundation 2010 and I wanted to create Report Data Source by code from my WebPart.

    First of all, I want to understand the difference between :

    http://server/ReportServer/reportservice2010.asmx  and


    My code runs in SharePoint context. When I use the first url, I have to put administrator crendentials to can call CreateDataSource Method.

    ReportingService2010 rs = new ReportingService2010();
    rs.Credentials = new NetworkCredential("admin", "Pwd", "domain");
    // Define the data source definition.
               DataSourceDefinition definition = new DataSourceDefinition();
               definition.CredentialRetrieval =
               definition.ConnectString =
                   "data source=(local);initial catalog=AdventureWorks";
               definition.Enabled = true;
               definition.EnabledSpecified = true;
               definition.Extension = "SQL";
               definition.ImpersonateUserSpecified = false;
               //Use the default prompt string.
               definition.Prompt = null;
               definition.WindowsCredentials = true;
               rs.CreateDataSource("OSS_Stats.rsds", "http://spf2010:10000/Lists/reports/", false, definition, null);

    It works fine but why should admin credantials, I saw msdn description for ReportService2010 and they used DefaultCredentials :

    rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

    In my case, it does not work and I obtain an error

    Microsoft.SharePoint.SPException: The user does not exist or is not unique. ---> System.Runtime.InteropServices.COMException: The user does not exist or is not unique.

    Should I use RunWithElevatedPrivileges ?

    When I tried to use the second url http://site/_vti/ReportServer/reportservice2010.asmx in visual studio I obtained 401 error ! I found this blog but it doesn't fix my problem.

    I hope that you could help me to resolve my issue.

    Best regards

    Consultant .Net/SharePoint

    Thursday, September 6, 2012 3:01 PM



    When the repor server runs in Native mode, we use the "http://<Server Name>/ReportServer/ReportService2010.asmx?wsdl" URL to access the WSDL for the management endpoint. If the report server is configured to run in SharePoint Integrated mode, we use the "http://<Server Name>/<Site Name>/_vti_bin/ReportServer/ReportService2010.asmx" URL to access the proxy endpoints.

    In this issue, I suggest that you add the following code snippet to replace the code "rs.Credentials = new NetworkCredential("admin", "Pwd", "domain")" in your code:

    rs.Url = "http://<Server Name>" +  "/_vti_bin/ReportServer/ReportService2010.asmx";
    rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

    Then, please set the  "definition.WindowsCredentials" to "false" instead.

    For more information, please see:
    ReportingService2010.CreateDataSource Method

    Hope this helps.

    Mike Yin

    TechNet Subscriber Support
    If you are TechNet Subscription user and have any feedback on our support quality, please send your feedbackhere.

    Mike Yin

    TechNet Community Support

    • Marked as answer by Mike Yin Sunday, September 16, 2012 4:34 PM
    Sunday, September 9, 2012 5:16 PM