This is a migrated thread and some comments may be shown as answers.

Invalid URI: The format of the URI could not be determined

4 Answers 213 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Manish
Top achievements
Rank 1
Manish asked on 08 Mar 2013, 01:07 PM

Hello,

In report class, i have GenerateReport mathod which returns report stream.

public Stream GenerateReport(ReportRequest reportRequest)

 

{


reportTable.DataSource = Data;

ReportProcessor

  

reportProcessor = new ReportProcessor();

  

return new MemoryStream(

 

reportProcessor.RenderReport(reportRequest.Format.ToString().ToUpper(),

 

this, new Hashtable())

 

.DocumentBytes);
}


But during reportProcessor.RenderReport mathod i am getting error that

""An error has occurred while processing Report 'Report':

Invalid URI: The format of the URI could not be determined.""

Also it is not firing reportTable_ItemDataBinding event.

In report constructor i am binding report table with event which insert cells and row/column groups dynamically.

reportTable.ItemDataBinding +=

 

new EventHandler(reportTable_ItemDataBinding);

 


Report is hosted by WCF reporting service and GenerateReport mathod is being called by WCF client. 

 

Please help. If you need specific more detail, please let me know.

Thanks,
Manish

 

4 Answers, 1 is accepted

Sort by
0
Hadib Ahmabi
Top achievements
Rank 1
answered on 12 Mar 2013, 11:19 AM
The RenderReport method's signature is the following:
RenderReport(string format ReportSource reportSource, Hashtable deviceInfo)
as second argument you are passing "this" and I believe that your current object isn't a ReportSource. 
This method should not be in a report and it's call should look like the following:

var reportSource = new InstanceReportSource { ReportDocument = reportObject };
var res = RenderReport(format, reportSource, deviceInfo);
0
Manish
Top achievements
Rank 1
answered on 15 Mar 2013, 07:37 AM
I tried to create seperate class to have GenerateReport method in that class as follow, but i am getting the same error.

    class ReportProvider
    {
        public Stream GenerateReport()
        {
            MyViewReport report =new MyViewReport();
            var reportSource = new InstanceReportSource { ReportDocument = report };
            ReportProcessor reportProcessor = new ReportProcessor();

            byte[] bytes = reportProcessor.RenderReport("PDF", reportSource, new Hashtable())
                                          .DocumentBytes;
            return new MemoryStream(bytes);
        }
    }

Thank you,
Manish

0
Hadib Ahmabi
Top achievements
Rank 1
answered on 19 Mar 2013, 01:21 PM
Maybe you are using URI somewhere in the report? SubReports, stylesheets, something like that and the engine cannot resolve it. Try replacing all paths with absolute ones. 
0
Manish
Top achievements
Rank 1
answered on 20 Mar 2013, 01:47 PM
Yes, stylesheet path was missing..Thank you..
Tags
General Discussions
Asked by
Manish
Top achievements
Rank 1
Answers by
Hadib Ahmabi
Top achievements
Rank 1
Manish
Top achievements
Rank 1
Share this question
or