Passing in content when generating JasperServer report using the REST API

后端 未结 3 1413
南旧
南旧 2021-02-08 10:32

I\'m working on a project that aims to replace our current PDF generator with JasperReports Server. The plan is to use the REST/HTTP API to reach a high level of abstraction bet

3条回答
  •  忘了有多久
    2021-02-08 10:55

    As you wrote, fetching data is more natural way for JRS. However, I needed to go the opposite way - I POST data to report sitting in JRS repo via a REST call.

    I pass XML data in my parameter "xmlDocument" and, by means of a "trick", an executed report can use this XML for further X-path queries.

    xmlDocument is just a simple String:

    
        "]]>
    
    

    At designing phase I create XML data adapter with XML file that I use for previewing. Note that a new parameter XML_INPUT_STREAM appeared after choosing XML adapter.

    Then I publish the report to JRS. During report execution, when the report is not linked to any data source, it reads XML_INPUT_STREAM parameter instead (as fallback data source), that looks as follows:

    
        
    
    

    I wrap "xmlDocument" string to InputStream.

提交回复
热议问题