eric.fenderbosch Posted January 15, 2014 Share Posted January 15, 2014 Sigh... I spent 20 minutes editing this and it is gone. Trying again.Maven dependencies:<dependency><groupId>com.jaspersoft.jasperserver</groupId><artifactId>jasperserver-common-ws</artifactId><version>5.1.0</version></dependency><dependency><groupId>com.jaspersoft.jasperserver.api.engine</groupId><artifactId>jasperserver-api-engine</artifactId><version>5.1.0</version></dependency><dependency><groupId>com.jaspersoft.jasperserver.api.common</groupId><artifactId>jasperserver-api-common</artifactId><version>5.1.0</version></dependency><dependency><groupId>axis</groupId><artifactId>axis</artifactId><version>1.3</version></dependency> Java code:Job job = new Job();job.setBaseOutputFilename("TODO");job.setLabel("subscription_ucic_counts - 81568 - 2013-12-01");JobMailNotification notification = new JobMailNotification();notification.setMessageText("PDF attached");notification.setResultSendType(ResultSendType.SEND_ATTACHMENT);notification.setSkipEmptyReports(false);notification.setSubject("subscription_ucic_counts - 81568 - 2013-12-01");notification.setToAddresses(new String[] { "me@mycompany.com" });job.setMailNotification(notification); job.setOutputFormats(new String[] { "PDF" }); JobParameter[] parameters = new JobParameter[2];parameters[0] = new JobParameter("parent_id_passed", 81568);parameters[1] = new JobParameter("date_passed", "2013-12-01");job.setParameters(parameters); job.setReportUnitURI("/reports/mycompany/Billing/subscription_ucic_counts");JobRepositoryDestination repositoryDestination = new JobRepositoryDestination();repositoryDestination.setFolderURI("/reports/mycompany/Billing/reports");repositoryDestination.setOverwriteFiles(true);repositoryDestination.setSequentialFilenames(false);job.setRepositoryDestination(repositoryDestination); JobSimpleTrigger trigger = new JobSimpleTrigger();trigger.setOccurrenceCount(1);Calendar startDate = DateTime.now().withZone(DateTimeZone.forID("America/Chicago")).plusMinutes(1).toGregorianCalendar();trigger.setStartDate(startDate);trigger.setTimezone(startDate.getTimeZone().getID());job.setSimpleTrigger(trigger); WebResource submitJob = restV2.path("jobs");Builder jobBuilder = submitJob.accept(MediaType.APPLICATION_XML).type(MediaType.APPLICATION_XML);Job submittedJob = jobBuilder.cookie(loginCookie).put(Job.class, job);XML sent on the wire:<?xml version="1.0" encoding="UTF-8" standalone="yes"?><job><baseOutputFilename>TODO</baseOutputFilename><id>0</id><label>subscription_ucic_counts - 81568 - 2013-12-01</label><mailNotification><id>0</id><messageText>PDF attached</messageText><resultSendType><value>SEND_ATTACHMENT</value></resultSendType><skipEmptyReports>false</skipEmptyReports><subject>subscription_ucic_counts - 81568 - 2013-12-01</subject><toAddresses>me@mycompany.com</toAddresses><version>0</version></mailNotification><outputFormats>PDF</outputFormats><parameters><name>parent_id_passed</name><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:int">81568</value></parameters><parameters><name>date_passed</name><value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">2013-12-01</value></parameters><reportUnitURI>/reports/mycompany/Billing/subscription_ucic_counts</reportUnitURI><repositoryDestination><folderURI>/reports/mycompany/Billing/reports</folderURI><id>0</id><overwriteFiles>true</overwriteFiles><sequentialFilenames>false</sequentialFilenames><version>0</version></repositoryDestination><simpleTrigger><id>0</id><startDate>2014-01-15T13:42:37.776-06:00</startDate><timezone>America/Chicago</timezone><version>0</version><occurrenceCount>1</occurrenceCount></simpleTrigger><version>0</version></job>And the response:<?xml version="1.0" encoding="UTF-8" standalone="yes"?><errors><error><errorCode>error.report.job.no.source</errorCode><field>source</field></error><error><defaultMessage>No output formats are selected for the job.</defaultMessage><errorCode>error.report.job.no.output.formats</errorCode><field>outputFormats</field></error></errors> I don't see a source field I can set and I have set the outputFormat field. Server info:Product Version: 5.1.0 Build: 20130508_1313 Any help? Thanks. Link to comment Share on other sites More sharing options...
eric.fenderbosch Posted January 15, 2014 Author Share Posted January 15, 2014 Ok, I've fixed the outputFormate message. It needs to be:<outputFormats><outputFormat>PDF</outputFormat></outputFormats> Strange that the provided classes don't generate valid XML. I've also added a source section: <source><reportUnitURI>/reports/mycompany/Billing/subscription_ucic_counts</reportUnitURI><parameters><entry><key>parent_id_passed</key><value>81568</value></entry><entry><key>date_passed</key><value>2013-12-01</value></entry></parameters></source> But now I'm getting a 500 w/ NPE. No helpful message. Link to comment Share on other sites More sharing options...
eric.fenderbosch Posted January 16, 2014 Author Share Posted January 16, 2014 Ok, looking in the server logs we found this:Unexpected error occursjava.lang.NullPointerException at com.jaspersoft.jasperserver.api.engine.scheduling.domain.ReportJobMailNotification.getResultSendType(ReportJobMailNotification.java:211) at com.jaspersoft.jasperserver.api.engine.scheduling.hibernate.PersistentReportJobMailNotification.copyFrom(PersistentReportJobMailNotification.java:130) at com.jaspersoft.jasperserver.api.engine.scheduling.hibernate.PersistentReportJob.copyMailNotification(PersistentReportJob.java:248) at com.jaspersoft.jasperserver.api.engine.scheduling.hibernate.PersistentReportJob.copyFrom(PersistentReportJob.java:136)... Link to comment Share on other sites More sharing options...
eric.fenderbosch Posted January 16, 2014 Author Share Posted January 16, 2014 Looks like the the mail notification wasn't correct.<resultSendType>SEND_ATTACHMENT</resultSendType> 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