Send data_source parameters Web Services (runReport)

0

Hello.

I have a problem. I wrote a simple code (groovy): 

public MainTest {
 
public static JasperPrint runReport(String reportUri, Map parameters) throws Exception {
JServer jServer = new JServer()
       jServer.setName(NAME_SERVER)
       jServer.setUsername(username)
       jServer.setPassword(password)
       ResourceDescriptor rd = new ResourceDescriptor()
       rd.setWsType(ResourceDescriptor.TYPE_JRXML)
       rd.setUriString(reportUri)
 
       return getServer(URL_REPOSITORY_SERVICE).getWSClient().runReport(rd, parameters)
}
 
 
public static void main() {
      String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><inforeports><report><webcastId>92354</webcastId></report><report><webcastId>92355</webcastId></report></inforeports>"
 
       Map<String, Object> params = new HashMap<String, Object>();
       Document document = JRXmlUtils.parse(new ByteArrayInputStream(xml.getBytes("UTF-8")))
       params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, document)
 
       runReport("/test/example_report_xml", params)
}}
 

How set parameter XML_DATA_SOURCE?  Because I have exception:

 

| Error java.lang.Exception: 1 - java.lang.String cannot be cast to org.w3c.dom.Document
| Error at com.jaspersoft.ireport.jasperserver.ws.WSClient.runReport(WSClient.java:403)
| Error at com.jaspersoft.ireport.jasperserver.ws.WSClient.runReport(WSClient.java:320)
| Error at com.jaspersoft.ireport.jasperserver.ws.WSClient$runReport.call(Unknown Source)
| Error at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
| Error at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
...

 

 

 

 

 

 

alexlat13's picture
Joined: Jan 17 2014 - 2:38am
Last seen: 4 years 1 month ago

0 Answers:

No answers yet
Feedback
randomness