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

Send data_source parameters Web Services (runReport)


alexlat13

Recommended Posts

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)
...

 

 

 

 

 

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...