CreateModel() error, URGENT!!!

Can anyone please suggest, how to make use rs.CreateModel() to publish model programmatically. I have designed the model, which I can publish from Report Designer and access through Report Builder. No issues at all.

But, when I take the same .smdl and publish using rs.CreateModel, I get the following error.

System.Web.Services: System.Web.Services.Protocols.SoapException: The DataSourceView is missing for the SemanticModel. SemanticModel must have exactly one DataSourceView element. ---> Microsoft.ReportingServices.Modeling.ValidationException: The DataSourceView is missing for the SemanticModel. SemanticModel must have exactly one DataSourceView element. at Microsoft.ReportingServices.Modeling.SemanticModel.Compile(XmlReader xr, ModelCompilationOptions options, CultureInfo defaultCulture) at Microsoft.ReportingServices.Library.ModelCreator.InitAndCheckParams() at Microsoft.ReportingServices.Library.CatalogItemCreator.CreateItem() at Microsoft.ReportingServices.Library.CreateModelAction.PerformActionNow() at Microsoft.ReportingServices.Library.RSSoapAction.Execute() at Microsoft.ReportingServices.WebServer.ReportingService2005.CreateModel(String Model, String Parent, Byte[] Definition, Property[] Properties, Warning[]& Warnings) --- End of inner exception stack trace --- at Microsoft.ReportingServices.WebServer.ReportingService2005.CreateModel(String Model, String Parent, Byte[] Definition, Property[] Properties, Warning[]& Warnings)

Following is the piece of code, which is givin the above error.

Dim fs As FileStream = File.OpenRead("C:\rs.smdl")

definition = New [Byte](fs.Length) {}

fs.Read(definition, 0, CInt(fs.Length))

rs.CreateModel("Sample", "/My Reports", definition, Nothing)

Any suggestions is highly appreciated. Thanks in advance.



Answer this question

CreateModel() error, URGENT!!!

  • Mark Kucera

    Thanks Lev,

    What is required to be done programmatically to make this work Any sample piece of code you can suggest

    Thanks again.


  • Harrives

    When Model Designer published a model, it embeds Data Source View (.dsv file) into it. You may download a model from server to see how it is done.



  • jbujold

    http://sameerct.blogspot.com/

    you need to

    1. Open the rs.dsv file
    2. Copy all code
    3. Paste just before the tag of </SemanticModel> in rs.smdl

  • CreateModel() error, URGENT!!!