TJasperServerExec : run report in Talend with parameter

0

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

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

Is anyone can help me ? Thanks in advance !

d.taillade's picture
Joined: Nov 14 2016 - 2:44am
Last seen: 1 year 1 month ago

6 Answers:

0

tJasperServerExec is a very old component. I just use JasperReports Server REST API with tRESTClient.

http://community.jaspersoft.com/documentation/tibco-jasperreports-server...

https://help.talend.com/display/TalendComponentsReferenceGuideFall1EN/tR...

 

hozawa's picture
54410
Joined: Apr 24 2010 - 4:31pm
Last seen: 6 months 1 day ago
0

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

and it's worked !

 

In Talend, I use tRestClient. In parameter I do :

URL : "http://localhost:8080/jasperserver/rest_v2/reports/reports/TestFactures/..."

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 !

d.taillade's picture
Joined: Nov 14 2016 - 2:44am
Last seen: 1 year 1 month ago
0

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.

hozawa's picture
54410
Joined: Apr 24 2010 - 4:31pm
Last seen: 6 months 1 day ago
0

Thanks for your answer.

But in my uri, I allready add authentication : http://localhost:8080/jasperserver/rest_v2/reports/reports/TestFactures/...?j_username=myusername&j_password=mypassword (I tested without I got an error of authentication)

 

Any other idea ?

d.taillade's picture
Joined: Nov 14 2016 - 2:44am
Last seen: 1 year 1 month ago
0

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

hozawa's picture
54410
Joined: Apr 24 2010 - 4:31pm
Last seen: 6 months 1 day ago
0

Hello,

it doesn't work with "http://localhost:8080/jasperserver/rest_v2/reports/reports/TestFactures/..."

I tested with API Chrome : Advanced Rest Client this URL and the status is OK

In response Header :

Server: Apache-Coyote/1.1
Cache-Control: private
Expires: Thu, 01 Jan 1970 01:00:00 CET
P3p: CP="ALL"
Content-Disposition: attachment; filename="facture.pdf"
Output-Final: true
Content-Type: application/pdf
Content-Length: 55627
Date: Fri, 30 Dec 2016 14:55:11 GMT
In 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 !
d.taillade's picture
Joined: Nov 14 2016 - 2:44am
Last seen: 1 year 1 month ago
Feedback
randomness