Sql Server Version #### Target?

Oct 16, 2009 at 3:26 PM

..

Ok, bear with me, because I'm mainly familiar with SSRS 2005.

Are these tasks meant to work with both 2005 and 2008?  Or is it geared toward one or the other?

(And which version was it developed against?)

I will post a second post with my WSDL contents for 2005 (so I don't overwhelm this post).

The reason I'm asking is that I'm a little fuzzy about (inside the project):

WebReference Name = MSReportService2005
points to:
http://localhost/reportserver2k8/ReportService2005.asmx

 

WebReference Name = MSReportService2006
points to:
http://localhost/reportserver2k8/ReportService2006.asmx

 

I have run some functions successfully, both one is failing (when trying to deploy to SSRS 2005):

Ok and working : DeleteReportFolder  CreateReportFolder  CreateReportingDataSource  AddReports 

Failing : SetReportDataSource

...........

I do not have a SSRS 2008 server to test against currently.

..........

Off the cuff, it seems like there needs to be a (custom) interface (or maybe abstract class), a factory (pattern) setup and a few concretes ...where each concrete encapsulates the talking to the specific version (2005, 2008, etc) of the webservice.

 

Something like this??

 

 


 public class WhichVersionOfSSRSFactory
 {
 
  public static ISSRSWebServiceAdaptor GetAdaptor(string key)
  {
   switch (key.ToUpper())
   {
    case "2005":
     return new SSRS2005WebServiceAdaptor();
    case "2008":
     return new SSRS2008WebServiceAdaptor();

    default:
     throw new ArgumentException("The WhichVersionOfSSRSFactory was given a Bad Key");
    
   }
  }
 }

 

Oct 16, 2009 at 3:28 PM

My error log, FYI:

Build started 10/15/2009 12:46:39 PM.
__________________________________________________
Project "----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj" (SetReportsDataSourceForMonthlyReports target(s)):

Target SetReportsDataSourceForMonthlyReports:
    ----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports: System.Web.Services.Protocols.SoapException: An attempt has been made to use a data extension '' that is not registered for this report server. ---> Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException: An attempt has been made to use a data extension '' that is not registered for this report server.
    ----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.Library.SetItemDataSourcesAction.VerifyDataSources(DataSourceInfoCollection dataSources, Int32 execOptions)
    ----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.Library.SetItemDataSourcesAction.SetReportDataSources(Guid itemID, Byte[] secDesc, DataSource[] dataSources, Int32 execOptions)
    ----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.Library.SetItemDataSourcesAction._SetItemDataSources(String itemPath, DataSource[] dataSources)
    ----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.Library.SetItemDataSourcesAction.SetItemDataSources(Guid batchId, String itemPath, DataSource[] dataSources)
    ----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.WebServer.ReportingService2005.SetItemDataSources(String Item, DataSource[] DataSources)
    ----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    --- End of inner exception stack trace ---
    ----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.WebServer.ReportingService2005.SetItemDataSources(String Item, DataSource[] DataSources)
Done building target "SetReportsDataSourceForMonthlyReports" in project "ReportSetupTaskTest.proj" -- FAILED.

Done building project "ReportSetupTaskTest.proj" -- FAILED.

Build FAILED.

----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports: System.Web.Services.Protocols.SoapException: An attempt has been made to use a data extension '' that is not registered for this report server. ---> Microsoft.ReportingServices.Diagnostics.Utilities.DataExtensionNotFoundException: An attempt has been made to use a data extension '' that is not registered for this report server.
----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.Library.SetItemDataSourcesAction.VerifyDataSources(DataSourceInfoCollection dataSources, Int32 execOptions)
----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.Library.SetItemDataSourcesAction.SetReportDataSources(Guid itemID, Byte[] secDesc, DataSource[] dataSources, Int32 execOptions)
----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.Library.SetItemDataSourcesAction._SetItemDataSources(String itemPath, DataSource[] dataSources)
----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.Library.SetItemDataSourcesAction.SetItemDataSources(Guid batchId, String itemPath, DataSource[] dataSources)
----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.WebServer.ReportingService2005.SetItemDataSources(String Item, DataSource[] DataSources)
----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    --- End of inner exception stack trace ---
----my directory structure----\src\SSRSMSBuildTasks\ssrsmsbuildtasks\bin\Debug\ReportSetupTaskTest.proj(109,5): Reporting error AddReports:    at Microsoft.ReportingServices.WebServer.ReportingService2005.SetItemDataSources(String Item, DataSource[] DataSources)
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:05.35

 

 

Coordinator
Oct 20, 2009 at 6:03 PM
Edited Oct 20, 2009 at 6:04 PM

Hi, these tasks work with both Reporting Services 2005 & 2008 in Native mode. They are being developed against Reporting Services 2008 Developer Edition.

The MSReportService2005 web reference points to the web services end point for a Native mode configured report server for version 2005 and 2008.

The MSReportService2006 web reference points to the web services end point for Integrated mode configured report server for version 2005 SP2 and 2008.

The plan for the MS Build tasks is for 2 versions under different namespaces; Native and Integrated.

From the look of the error log that you posted the data source was created without a valid data provider and caused an error when assigned for use within a report. This could be because there is some metadata missing within the item group of the data source. Something I will be adding to the CreateDataSource task for both Native and Integrated mode is for exceptions to be thrown highlighting when required metadata is missing.

Thanks for Feedback

Oct 21, 2009 at 1:55 PM

Ok, great.

Armed with that information, I'll re-trace my steps and see if I had a miscue.

Thanks for the followup.  I am definately trying to get this to be a part of my automation-build process.

..

Oct 23, 2009 at 6:59 PM

Ok, I finally did some tracking.

 

The issue here is a non graceful way of handling a non matching key-find.

 

public class NativeDeploymentManger

AssignReportDataSource (the method)

private void AssignReportDataSource(string report, Hashtable dataSources, bool useMatchCase)

 

........

 

Here is the code, slightly reworked(no logic changes...just a separate line to set the keyToFind value.

 

// look for match in the list of data sources
                string keyToFind = useMatchCase ? reportDataSources[index].Name : reportDataSources[index].Name.ToLower(); // I put this on its own line so I could see the key(ToFind) value more clearly
                if (
                    dataSources.ContainsKey(keyToFind))
                {
                    // assgin the matched data source reference to the report.
                    dataSourceRef = new DataSourceReference
                        {
                            Reference =
                                dataSources[
                                    useMatchCase
                                        ? reportDataSources[index].Name
                                        : reportDataSources[index].Name.ToLower()] as string
                        };
                    reportDataSources[index].Item = dataSourceRef;
                    dataSourceUpdates.Append(
                        string.Format("{0}:{1};", reportDataSources[index].Name, dataSourceRef.Reference));
                }

// What happens if there is no matching key found in the array/dictionary??

 

The issue I'm experiencing is that I don't find a match. 

 

so at the very least I would suggest an "else" after the block above.

 

else

{

throw new ArgumentNullException ( string.Format ( "The dataSources did not find a key-match on '{0}'" , keyToFind ) );

}

................

 

Below is a hack I put in.

I am not suggesting it as a permanent fix............but I am showing it just in case anyone gets "stuck".

 

else
                {
                    //No match found!
                    dataSourceRef = new DataSourceReference();
                    object key0 = string.Empty; // Hack to wire it up to the first item in the array
                    IDictionaryEnumerator ide = dataSources.GetEnumerator();
                    while (ide.MoveNext())
                    {
                        key0 = ide.Key;
                        break;
                    }
                    dataSourceRef.Reference = dataSources[key0] as string;
                    reportDataSources[index].Item = dataSourceRef;
                    dataSourceUpdates.Append(
                        string.Format("{0}:{1};", reportDataSources[index].Name, dataSourceRef.Reference));

                }

 

 

 

The original error I was getting was because the key was not found.........thus it fell through with a null dataSourceRef.

 

 

Oct 29, 2009 at 6:27 PM
Edited Oct 29, 2009 at 7:52 PM

 

I think I have discovered what brings on this issue.

 

Here is a portion of the .rdlc of my report:

 

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <DataSources>
    <DataSource Name="DataSourceForDevelopmentEnvironmentDefinedInRDLC">
      <rd:DataSourceID>f9cf60e3-0f45-43a6-9376-c5b9becb08f7</rd:DataSourceID>
      <ConnectionProperties>
        <DataProvider>SQL</DataProvider>
        <ConnectString />
      </ConnectionProperties>
    </DataSource>
  </DataSources>

 

Notice the "DataSourceForDevelopmentEnvironmentDefinedInRDLC" value.

(I've used a very long name to try and describe what is happening.........my actual value isn't that crazy long).

 

If I setup a DataSource

(Either through the ssrsmsbuildtasks Custom Task
or
through my local ReportServer/Manager url     .........     (like http://localhost/ReportManager1/ ) ---and use the "New Data Source" button --
)

and I call it something different  than DataSourceForDevelopmentEnvironmentDefinedInRDLC

(in my example I call it

"DataSourceForProductionEnvironmentDefinedThroughReportManager1"

)

 

This will create a key not found issue, the one that I originally spoke of.

....................

My work around code is similar to the above, but I put in some error checking in case I cannot pull the first dataSource

My work around code is below......in bold.  Basically, the KEY trying to be located is of the value "DataSourceForDevelopmentEnvironmentDefinedInRDLC", and it will never find that key, because it is not one of my dataSources on my production report server.  (Make any sense?)

 

if (
    dataSources.ContainsKey(useMatchCase ? reportDataSources[index].Name : reportDataSources[index].Name.ToLower()))
{

         //all the same original code here that I did not paste in

}

//Work Around Code START

else
                {
                    if (dataSources.Count > 1)
                    {
                        //If there is more than 1 datasource, then we cannot just pull off the first one
                        string reportDataSourcesFlatList = string.Empty;
                        if (null != reportDataSources)
                        {
                            for (int k = 0; k < reportDataSources.Length; k++)
                            {
                                if (null != reportDataSources[k])
                                {
                                    reportDataSourcesFlatList += "'" + reportDataSources[k].Name + "' : ";
                                }
                            }
                        }
                        string errorMsg = string.Format("There was an issue finding a match.  The DataSourceKeyName of '{0}' could not be located, and there are more than 1 DataSources to choose from ({1})", keyToFind, reportDataSourcesFlatList);
                        throw new ArgumentOutOfRangeException(errorMsg);
                    }

                    //No match found......and there is 1 datasource to pick from, so use it
                    dataSourceRef = new DataSourceReference();
                    object key0 = string.Empty; // Hack to wire it up to the first item in the array
                    IDictionaryEnumerator ide = dataSources.GetEnumerator();
                    while (ide.MoveNext())
                    {
                        //Enumerate to find the first key, then break out
                        key0 = ide.Key;
                        break;
                    }
                    dataSourceRef.Reference = dataSources[key0] as string;
                    reportDataSources[index].Item = dataSourceRef;
                    dataSourceUpdates.Append(string.Format("{0}:{1};", reportDataSources[index].Name, dataSourceRef.Reference));

                }

//Work Around Code END

 

I am up and running, but I don't have any reports that use more than 1 datasources currently.  If I ever do, my work around will obviously not work.

 

Steps to reproduce.

Create a report in development through Visual Studio (2008 for me) (Ex: "EmployeeReport1.rdlc")

Give it a DataSourceName of "DataSourceForDevelopmentEnvironmentDefinedInRDLC" (you may have to hand edit the .rdlc through notepad)

Create a (Report Server) DataSource not named DataSourceForDevelopmentEnvironmentDefinedInRDLC. ( "DataSourceForProductionEnvironmentDefinedThroughReportManager1" for example) either through the ReportServer GUI or via the custom task ssrsmsbuildtasks.Native.CreateReportingDataSource.

Deploy EmployeeReport1.rdlc (via this custom task) to the Report Server.

Use the (custom task) ssrsmsbuildtasks.Native.SetReportDataSource and try to wire up the report (EmployeeReport1.rdlc for example) to the DataSource called "DataSourceForProductionEnvironmentDefinedThroughReportManager1" on the Report Server.

 

..............


I hope that defines the issue, and the one work around fairly decently.

Thanks.............................

 

 

 

NOTE:

The name of the DataSource in the .rdlc shows up more than once usually, so if you hand edit, make sure you get them all:

Here is a partial of what I'm talking about:

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <DataSources>
    <DataSource Name="DataSourceForDevelopmentEnvironmentDefinedInRDLC">
      <rd:DataSourceID>f9cf60e3-0f45-43a6-9376-c5b9becb08f7</rd:DataSourceID>
      <ConnectionProperties>
        <DataProvider>SQL</DataProvider>
        <ConnectString />
      </ConnectionProperties>
    </DataSource>
  </DataSources>
      <Query>
        <DataSourceName>DataSourceForDevelopmentEnvironmentDefinedInRDLC</DataSourceName>
        <CommandType>StoredProcedure</CommandType>
        <CommandText>dbo.uspEmployeeGetAll</CommandText>
        <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
      </Query>