Monday, February 20, 2012

LoadReportDefinition->Root element is missing!?

Hi all,
I try to load a RDL-File by code with the following statement:
rpvReport.ServerReport.LoadReportDefinition(strReader);
Unfortunaltely the following error occurs "Root element is missing"
(see more beneath).
I dont get the point as in my eyes the rdl (xml) files i tried are
well-formed.
Also when I upload them by the report manager they are created without
any problems.
Does anybody have a clue where the bug could be?
THX a lot for any help!!
Cheers
Marc
RDL-FILE:
---
<?xml version=3D"1.0" encoding=3D"utf-8"?>
<Report
xmlns=3D"http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdef= inition"
xmlns:rd=3D"http://schemas.microsoft.com/SQLServer/reporting/reportdesigner= ">
<PageWidth>7.5 in</PageWidth>
<ReportParameters>
</ReportParameters>
<LeftMargin>0.5 in</LeftMargin>
<RightMargin>0.5 in</RightMargin>
<TopMargin>0.5 in</TopMargin>
<BottomMargin>0.3 in</BottomMargin>
<PageHeader>
<Height>1 in</Height>
<ReportItems>
<Textbox Name=3D"Label13">
<Value>PAGE HEADER CONTROL</Value>
</Textbox>
</ReportItems>
</PageHeader>
<Body>
<ReportItems>
<Line Name=3D"BodyLine">
</Line>
</ReportItems>
<Height>1 in</Height>
<Style />
</Body>
<PageFooter>
<Height>0.17 in</Height>
<ReportItems>
<Textbox Name=3D"Label18">
<Value>PAGE FOOTER CONTROL</Value>
</Textbox>
</ReportItems>
</PageFooter>
</Report>
----
ERROR-MESSAGE:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 09.10.2006 18:37:19
Event time (UTC): 09.10.2006 16:37:19
Event ID: f84f56da10ee4e3991c3de6244b58009
Event sequence: 36
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: cab7894e-6-128048849773258592
Trust level: Full
Application Virtual Path: /
Application Path: C:\_workspace\RenoSF.Reporting\Controls\
Machine name: MTHIERRTCB2TR
Process information:
Process ID: 3600
Process name: WebDev.WebServer2.exe
Account name: DELTA_ZUG\mthierer
Exception information:
Exception type: ReportServerException
Exception message: Die Berichtsdefinition ist ung=FCltig. Details:
Root element is missing. (rsInvalidReportDefinition)
Request information:
Request URL: http://localhost:1831/default.aspx
Request path: /default.aspx
User host address: 127.0.0.1
User: DELTA_ZUG\mthierer
Is authenticated: True
Authentication Type: NTLM
Thread account name: DELTA_ZUG\mthierer
Thread information:
Thread ID: 4
Thread account name: DELTA_ZUG\mthierer
Is impersonating: False
Stack trace: at
Microsoft.Reporting.WebForms.ServerReport.LoadReportDefinition(TextReader
report)
at
RTC.SharePoint.RenoSF.Reporting.BasisReports.ReportFormControls.ReportViewe= r=2ELoadDefinition(List`1
list, String rdl) in
C:\_workspace\RenoSF.Reporting\Controls\ReportFormControls\ReportViewer.asc= x=2Ecs:line
90
at
RTC.SharePoint.RenoSF.Reporting.BasisReports.ReportFormControls.ReportViewe= r=2EBtnCreateReportClick(Object
sender, EventArgs e) in
C:\_workspace\RenoSF.Reporting\Controls\ReportFormControls\ReportViewer.asc= x=2Ecs:line
138
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaiseP= ostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)ReportingService2005 rs = new ReportingService2005();
byte[] b = rs.GetReportDefinition("/ReportServer/RolesReport");
MemoryStream strm = new MemoryStream(b);
XmlDocument doc = new XmlDocument();
doc.Load(strm);
// modify xml for ad-hoc report
MemoryStream strmOut = new MemoryStream();
doc.Save(strmOut);
strmOut.Position = 0; // must call this
this.rvReport.ProcessingMode =Microsoft.Reporting.WebForms.ProcessingMode.Remote;
this.rvReport.ServerReport.ReportServerUrl = new
Uri("http://localhost/ReportServer");
this.rvReport.ServerReport.ReportPath = "/ReportServer/RolesReport";
this.rvReport.ServerReport.LoadReportDefinition(strmOut);
System.Diagnostics.Debug.WriteLine(this.rvReport.ServerReport.GetExecutionId());
strm.Close();
strmOut.Close();
I think you lost " strmOut.Position = 0";
--sidney
"Marc" wrote:
> Hi all,
> I try to load a RDL-File by code with the following statement:
> rpvReport.ServerReport.LoadReportDefinition(strReader);
> Unfortunaltely the following error occurs "Root element is missing"
> (see more beneath).
> I dont get the point as in my eyes the rdl (xml) files i tried are
> well-formed.
> Also when I upload them by the report manager they are created without
> any problems.
> Does anybody have a clue where the bug could be?
> THX a lot for any help!!
> Cheers
> Marc
>
> RDL-FILE:
> ---
> <?xml version="1.0" encoding="utf-8"?>
> <Report
> xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition"
> xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
> <PageWidth>7.5 in</PageWidth>
> <ReportParameters>
> </ReportParameters>
> <LeftMargin>0.5 in</LeftMargin>
> <RightMargin>0.5 in</RightMargin>
> <TopMargin>0.5 in</TopMargin>
> <BottomMargin>0.3 in</BottomMargin>
> <PageHeader>
> <Height>1 in</Height>
> <ReportItems>
> <Textbox Name="Label13">
> <Value>PAGE HEADER CONTROL</Value>
> </Textbox>
> </ReportItems>
> </PageHeader>
> <Body>
> <ReportItems>
> <Line Name="BodyLine">
> </Line>
> </ReportItems>
> <Height>1 in</Height>
> <Style />
> </Body>
> <PageFooter>
> <Height>0.17 in</Height>
> <ReportItems>
> <Textbox Name="Label18">
> <Value>PAGE FOOTER CONTROL</Value>
> </Textbox>
> </ReportItems>
> </PageFooter>
> </Report>
> ----
>
> ERROR-MESSAGE:
> Event code: 3005
> Event message: An unhandled exception has occurred.
> Event time: 09.10.2006 18:37:19
> Event time (UTC): 09.10.2006 16:37:19
> Event ID: f84f56da10ee4e3991c3de6244b58009
> Event sequence: 36
> Event occurrence: 1
> Event detail code: 0
> Application information:
> Application domain: cab7894e-6-128048849773258592
> Trust level: Full
> Application Virtual Path: /
> Application Path: C:\_workspace\RenoSF.Reporting\Controls\
> Machine name: MTHIERRTCB2TR
> Process information:
> Process ID: 3600
> Process name: WebDev.WebServer2.exe
> Account name: DELTA_ZUG\mthierer
> Exception information:
> Exception type: ReportServerException
> Exception message: Die Berichtsdefinition ist ungültig. Details:
> Root element is missing. (rsInvalidReportDefinition)
> Request information:
> Request URL: http://localhost:1831/default.aspx
> Request path: /default.aspx
> User host address: 127.0.0.1
> User: DELTA_ZUG\mthierer
> Is authenticated: True
> Authentication Type: NTLM
> Thread account name: DELTA_ZUG\mthierer
> Thread information:
> Thread ID: 4
> Thread account name: DELTA_ZUG\mthierer
> Is impersonating: False
> Stack trace: at
> Microsoft.Reporting.WebForms.ServerReport.LoadReportDefinition(TextReader
> report)
> at
> RTC.SharePoint.RenoSF.Reporting.BasisReports.ReportFormControls.ReportViewer.LoadDefinition(List`1
> list, String rdl) in
> C:\_workspace\RenoSF.Reporting\Controls\ReportFormControls\ReportViewer.ascx.cs:line
> 90
> at
> RTC.SharePoint.RenoSF.Reporting.BasisReports.ReportFormControls.ReportViewer.BtnCreateReportClick(Object
> sender, EventArgs e) in
> C:\_workspace\RenoSF.Reporting\Controls\ReportFormControls\ReportViewer.ascx.cs:line
> 138
> at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
> at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
> eventArgument)
> at
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
> eventArgument)
> at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
> sourceControl, String eventArgument)
> at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
> postData)
> at System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
>

No comments:

Post a Comment