locked
oData Service Operation return binary stream RRS feed

  • Question

  • I am using IDataServiceStreamProvider to download a pdf associated with an entity. The pdf is a report  generated dynamically (from SQL Server Reporting Services).  My goal is to allow REST access to my SQL Server Reports.

    My report object has the hasStream attribute and it works correctly. The report object is returned from odataService.svc/reports(1) and the pdf is returned  from odataService.svc/reports(1)/$value

    I would like to be able to get the pdf from a service operation (RunReport) which returns the same entity but would take parameters which I can pass onto the report generator, but I am unable to as the data service responds with a message stating 

     

    Resource Not Found - 'RunReport' refers to a service operation which does not allow further composition.

     

    Friday, November 4, 2011 5:00 PM

Answers

  • Can you copy and paste the method header that you have for the ServiceOperation itself?

    For serviceoperations if you want to compose on the query further with a Uri like this

    odataService.svc/RunReports(1), then I would expect a service operation header like this

    [WebGet()]

    public IQueryable<Report>RunReports()

    You must have it return a IQueryable, because you cannot compose on something that return IEnumerable.

    See http://msdn.microsoft.com/en-us/library/cc668788.aspx for more details on ServiceOperations. Let me know if you have any further questions.

    Thanks,

    Chris Robinson - OData Test Team


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, November 4, 2011 8:39 PM
    Moderator

All replies

  • Can you copy and paste the method header that you have for the ServiceOperation itself?

    For serviceoperations if you want to compose on the query further with a Uri like this

    odataService.svc/RunReports(1), then I would expect a service operation header like this

    [WebGet()]

    public IQueryable<Report>RunReports()

    You must have it return a IQueryable, because you cannot compose on something that return IEnumerable.

    See http://msdn.microsoft.com/en-us/library/cc668788.aspx for more details on ServiceOperations. Let me know if you have any further questions.

    Thanks,

    Chris Robinson - OData Test Team


    This posting is provided "AS IS" with no warranties, and confers no rights.
    Friday, November 4, 2011 8:39 PM
    Moderator
  • Thanks.  I originally had the return as IQueryable and changed it so that it would return a single report

     

    Monday, November 7, 2011 6:19 PM