Jump to content
We've recently updated our Privacy Statement, available here ×

pass XML with service request?


jgladden

Recommended Posts

How do I pass XML with the report service request to JasperServer? (rather than predefining a datasource) I would like to construct XML on the fly, pass it to JasperServer in the request, and receive a PDF. I have JRXML reports (created by iReport) in my repository already -- they are configured to an XML datasource. Thoughts?

 

Code:
<request operationName="runReport" locale="en">
<argument name="RUN_OUTPUT_FORMAT">PDF</argument>
<resourceDescriptor name="" wsType="" uriString="XMLReport" isNew="false">
<label>null</label>
</resourceDescriptor>
</request>

 

thanks in advance, john

johngladden1978@gmail.com

Link to comment
Share on other sites

  • 2 years later...
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Sherman,

Thanks for your reply;

Except for the official documentation shipped with jasperserver, and the offficial documentation we bought (all J-ultimate Guides), studied in depth, which however "only" show, cite, state examples of custom datasources, I were not able to locate any ressources, like downloadable code-examples of or ready to use custom datasources for the described specific task?

Could you point me towards such a ressource?

I feel such add-on downloads (supported or not) would add an incredible benefit supporting the proliferation of the product.

Me feels that iReport with its wast datasources, meanwhile is way ahead of JS, which IMHO should not necessary be the case.

Suggestion: setup a wiki-page describing howto "migrate" iReport DataSources to JasperServer?

Thanks upfront,

regards Georg

 

 

 

Link to comment
Share on other sites

Sherman,

I solved the task, without the need of a new custom datasource, the following way.
hth someone searching the archives later on;
regards Georg

a) added xpath2 functionality to jasperserver 3.5 see:
see http://jasperforge.org/plugins/espforum/view.php?group_id=112&forumid=102&topicid=68744

b) used a java.lang.String input parameter, which ist then taken over by the org.w3c.dom.Document XML_DATA_DOCUMENT;
within the main report I used something like:
<parameter name="XML_DATA" class="java.lang.String">
    <defaultValueExpression><![CDATA["<data><node1>node1-text</node1><node2>node2-text</node2></data>"]]></defaultValueExpression>
</parameter>
<parameter name="XML_DATA_DOCUMENT" class="org.w3c.dom.Document" isForPrompting="false">
    <defaultValueExpression><![CDATA[net.sf.jasperreports.engine.util.JRXmlUtils.parse(new org.xml.sax.InputSource(new java.io.StringReader($P{XML_DATA})))]]></defaultValueExpression>
</parameter>
<queryString language="xpath2">
    <![CDATA[/data]]>
</queryString>

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...