alexlat13 Posted January 29, 2014 Share Posted January 29, 2014 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) jServer.setUrl(http://localhost:8080/jasperserver/services/repository) 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now