How to use a XML String as a source of Report in JasperServer?



I'm trying to use a XML String as a source of a report which is published in a JasperServer. First of all I'm using Jasper 6.5.1, and my application is JSF.

I have an report which receives an xPath as source, but the only way that I'd work was:

- I create a webservice where I select the entity in database (the xml field is in this entity), so I return the Response.ok and the method produces a XML.
- Then in the print calling I create the URL pointing to my own WS and I pass the URL as parameter net.sf.jasperreports.xml.source, but I think is a code smell because in the print calling method I already have the entity and the XML String, but I need to build an URL send to the report and the report call the webservice to get the same XML as a source.

So now I'm have a similar situation but I don't have the entity yet so I couldn't use that workaround, so I need to pass the XML to the report as String, as Document, as InputStream or whatever.

But it didn't work. Is there any example or way that I could do this?

Now I'm trying to do like this:

..parameters.put("XML_DATA_DOCUMENT", JRXmlUtils.parse(new InputSource(new StringReader(nfe.getSisXml())), true));..

But I'm getting:

..Caused by: java.lang.IllegalArgumentException: Infinite recursion (StackOverflowError) (through reference chain: org.apache.xerces.dom.DeferredDocumentImpl["firstChild"]->org.apache.xerces.dom.DeferredElementNSImpl["ownerDocument"]..

Thanks in advance

guibernardi's picture
Joined: Aug 17 2017 - 4:42am
Last seen: 12 months 4 days ago

0 Answers:

No answers yet