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

Perl script to run Jasper Server report via SOAP::Lite


liam.cullen

Recommended Posts

I want to run a Jasper Server Report from a Perl script (connect, sign on eg as jasperadmin, run a report from the repository, return the results) but cannot get it to work.

I am baffled as to why there appears to be no information on this subject (use of Perl for Jasper Reports) anywhere... normally the Perl community is prolific, and I know that Perl and Jasper (ETL that is) have a bit of history.

The only reference I can find to someone attempting the same thing, is an old post where the OP had the same error as me... (http://community.jaspersoft.com/questions/522299/problem-runreport-using-perl-soaplite) ... the error being that the Tomcat default management page is returned. However, there is no solution provided, just a suggestion to check that JasperServer is running (it is).

For another poster who tries to use Perl in a CGI script to run a Jasper Report, the suggested solution is to "use Java".

There must be more information available on this subject, somewhere... this can't be that unusual a thing to attempt... Perl is the most concise, flexible and user-firendly (IMO) scripting language out there, and normally has an answer for everything...!

I have tried both authenticating inline in the service URL, or separately passing credentials... but I must be doing something stupid, surely.

What am I doing wrong? 

Code as follows...

 

#!/usr/bin/perl -w
 
use SOAP::Lite;
 
$op_xml = "<request operationName="runReport" locale="en" >";
$op_xml .= "<argument name="RUN_OUTPUT_FORMAT">PDF</argument>";
$op_xml .= "<resourceDescriptor name="" wsType="reportUnit" uriString="/Reports/samples/SalesByMonth" isNew="false">";
$op_xml .="</resourceDescriptor></request>";
 
 
my $soap = new SOAP::Lite
readable => 1,
service => 'http://jasperadmin:jasperadmin@HOST:PORT/jasperserver/services/repository?wsdl',
uri => '/Reports/samples/SalesByMonth',
proxy => 'http://HOST:PORT';
 
my $som = $soap->runReport($op_xml);
 
foreach my $part (${$som->parts}) {
print $part->stringify;
}
 
 
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

I'm not that used to working with the SOAP API or with Perl :( but i would recommend you using the new REST API http://community.jaspersoft.com/documentation/jasperreports-server-web-services-guide/v550/running-report

To get the report is just a simple GET call "http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/path/to/report.pdf?<arguments>" the credentials can be pased as a Basic Auth Header or as arguments (j_username and j_password)

Link to comment
Share on other sites

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