d.taillade Posted December 19, 2016 Share Posted December 19, 2016 Hello,I need to run a report with parameters calculated in Talend. I found the plugin tJasperServerExec and I read the tutorial http://community.jaspersoft.com/wiki/tjasperserverexec-tutorialBut I get this error :[iNFO ]: org.apache.commons.httpclient.HttpMethodDirector - Redirect requested but followRedirects is disabledAxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode: faultString: (302)D�plac� Temporairement faultActor: faultNode: faultDetail: {}:return code: 302{http://xml.apache.org/axis/}HttpErrorCode:302(302)D�plac� Temporairement at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:218) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366)[WARN ]: org.apache.commons.httpclient.HttpMethodBase - Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended. at org.apache.axis.client.Call.invoke(Call.java:1812) at com.jaspersoft.jasperserver.irplugin.wsclient.RepositorySoapBindingStub.runReport(RepositorySoapBindingStub.java:193) at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.runReport(WSClient.java:390) at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.runReport(WSClient.java:311) at test1.jasper_0_1.jasper.tFileInputDelimited_2Process(jasper.java:577) at test1.jasper_0_1.jasper.runJobInTOS(jasper.java:975) at test1.jasper_0_1.jasper.main(jasper.java:832)Exception in component tJasperServerExec_1AxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode: faultString: (302)D�plac� Temporairement faultActor: faultNode: faultDetail: {}:return code: 302{http://xml.apache.org/axis/}HttpErrorCode:302(302)D�plac� Temporairement at org.apache.axis.transport.http.CommonsHTTPSender.invoke(CommonsHTTPSender.java:218) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165) at org.apache.axis.client.Call.invokeEngine(Call.java:2784) at org.apache.axis.client.Call.invoke(Call.java:2767) at org.apache.axis.client.Call.invoke(Call.java:2443) at org.apache.axis.client.Call.invoke(Call.java:2366) at org.apache.axis.client.Call.invoke(Call.java:1812) at com.jaspersoft.jasperserver.irplugin.wsclient.RepositorySoapBindingStub.runReport(RepositorySoapBindingStub.java:193)[statistics] disconnected at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.runReport(WSClient.java:390) at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.runReport(WSClient.java:311) at test1.jasper_0_1.jasper.tFileInputDelimited_2Process(jasper.java:577) at test1.jasper_0_1.jasper.runJobInTOS(jasper.java:975) at test1.jasper_0_1.jasper.main(jasper.java:832)[/code]Is anyone can help me ? Thanks in advance ! Link to comment Share on other sites More sharing options...
hozawa Posted December 20, 2016 Share Posted December 20, 2016 tJasperServerExec is a very old component. I just use JasperReports Server REST API with tRESTClient.http://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v630/export-servicehttps://help.talend.com/display/TalendComponentsReferenceGuideFall1EN/tRESTClient Link to comment Share on other sites More sharing options...
d.taillade Posted December 20, 2016 Author Share Posted December 20, 2016 Thanks for your answer. So I tested tRestClient but it doesn't work (I don't know how to set it ...)My report is published on server, in Reports/TestFactures, and it's called "facture".When I want to execute it via URL to generate a PDF, I do : http://localhost:8080/jasperserver/flow.html?_flowId=viewReportFlow&ParentFolderUri=/reports/TestFactures&reportUnit=/reports/TestFactures/facture&decorate=no&WITH_NUMFACT=1&IN_NOTIN=0&NUMFACT=161102523&output=pdfand it's worked ! In Talend, I use tRestClient. In parameter I do :URL : "http://localhost:8080/jasperserver/rest_v2/reports/reports/TestFactures/facture.pdf?j_username=myusername&j_password=mypassword"Parameters : I write the parameters of my URL with values (WITH_NUMFACT, IN_NOTIN and NUMFACT)I don't know if to write other marameters.When I execute this, I get the error : "No message body reader has been found for class org.dom4j.Document, ContentType: text/html;charset=UTF-8"I read lots of forums and the "JasperReports Server Web Service Guide" but I don't manage to do it ... and I don't understand how generate the PDF and save it on server or anywhere.Do you have some examples, tutorials, ... ? Thanks in advance for your help ! Link to comment Share on other sites More sharing options...
hozawa Posted December 21, 2016 Share Posted December 21, 2016 REST API are just GET calls. Try entering them in your web browser to see if you get any response.I think you're just missing authentication. To test, you can just add "j_username=<user name to login to JasperReports Server>" and "j_password" to your uri. Link to comment Share on other sites More sharing options...
d.taillade Posted December 21, 2016 Author Share Posted December 21, 2016 Thanks for your answer.But in my uri, I allready add authentication : http://localhost:8080/jasperserver/rest_v2/reports/reports/TestFactures/facture.pdf?j_username=myusername&j_password=mypassword (I tested without I got an error of authentication) Any other idea ? Link to comment Share on other sites More sharing options...
hozawa Posted December 25, 2016 Share Posted December 25, 2016 Sorry, pointed you to a wrong API.Use the report service and just specify "pdf" as the output format. This is what I'm doing.http://community.jaspersoft.com/documentation/tibco-jasperreports-server-rest-api-reference/v630/reports-service Link to comment Share on other sites More sharing options...
d.taillade Posted December 30, 2016 Author Share Posted December 30, 2016 Hello,it doesn't work with "http://localhost:8080/jasperserver/rest_v2/reports/reports/TestFactures/facture.pdf?j_username=myusername&j_password=mypassword&WITH_NUMFACT=1&IN_NOTIN=0&NUMFACT=161102523&output=pdf"I tested with API Chrome : Advanced Rest Client this URL and the status is OKIn response Header :Server: Apache-Coyote/1.1Cache-Control: privateExpires: Thu, 01 Jan 1970 01:00:00 CETP3p: CP="ALL"Content-Disposition: attachment; filename="facture.pdf"Output-Final: trueContent-Type: application/pdfContent-Length: 55627Date: Fri, 30 Dec 2016 14:55:11 GMTIn raw, I have lots of text (perhaps the pdf contains ?)%PDF-1.5 %���� 7 0 obj <</Filter/FlateDecode/Length 2996>>stream x���v����MOmc�� [...] When I tested with Talend, I remove checkbox "Convert Response to DOM Document" and I get the same result in the field "String" If it's the PDF, how can I save in a file ? Thanks in advance for your help ! 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