Run JesperReport from Apex

Run JesperReport from Apex

HTML Header
===============================

function xlibUrl(pAdditionalParams){
var url;
url = “http://localhost:8888/JasperReportsIntegration/report?_repName=Sample/EmployeeInfo&_repFormat=pdf&_dataSource=default&_outFilename=&_repLocale=de_DE&_repEncoding=UTF-8”
if (pAdditionalParams) url = url + “&deptid=” + pAdditionalParams;
window.open(url);
return false;
}

— paste it to Apex page properties >> HTML Header >> HTML Header
— Change apache port — set parameter

set button property
–Advanced >> Custom Attributes >> onClick=”return xlibUrl($x(‘P32_NEW’).value);”

custom attribute
=============================

onClick=”return xlibUrl($x(‘P8_NEW’).value);”

alternative code:
================================
begin
xlib_jasperreports.set_report_url(‘http://faculty2:8888/JasperReportsIntegration/reports’);
xlib_jasperreports.show_report (p_rep_name => :p5_rep_name,
p_rep_format => :p5_rep_format,
p_data_source => :p5_data_source,
p_out_filename => :p5_out_filename,
p_rep_locale => :p5_rep_locale,
p_rep_encoding => :p5_rep_encoding,
p_additional_params => :p5_additional_params);
apex_application.g_unrecoverable_error := true;
end;

BEGIN
DBMS_NETWORK_ACL_ADMIN.assign_acl (
acl => ‘JasperReportsIntegration.xml’,
host => ‘192.168.10.15’,
lower_port => 80,
upper_port => NULL);
DBMS_NETWORK_ACL_ADMIN.assign_acl (
acl => ‘JasperReportsIntegration.xml’,
host => ‘10.1.10.*’,
lower_port => NULL,
upper_port => NULL);
COMMIT;
end ;

COLUMN host FORMAT A30
COLUMN acl FORMAT A30

SELECT host, lower_port, upper_port, acl
FROM dba_network_acls;

SELECT DECODE(
DBMS_NETWORK_ACL_ADMIN.check_privilege(‘JasperReportsIntegration.xml’, ‘TEST’, ‘connect’),
1, ‘GRANTED’, 0, ‘DENIED’, NULL) privilege
FROM dual;

GRANT EXECUTE ON UTL_HTTP TO test ;

DECLARE
l_url VARCHAR2(50) := ‘http://192.168.10.15:80’;
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
BEGIN
l_http_request := UTL_HTTP.begin_request(l_url);
l_http_response := UTL_HTTP.get_response(l_http_request);
UTL_HTTP.end_response(l_http_response);
END;
/

DECLARE
l_url VARCHAR2(50) := ‘http://192.168.10.15:80’;
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
BEGIN
— Make a HTTP request and get the response.
l_http_request := UTL_HTTP.begin_request(l_url);
l_http_response := UTL_HTTP.get_response(l_http_request);
UTL_HTTP.end_response(l_http_response);
END;
/

BEGIN
DBMS_NETWORK_ACL_ADMIN.create_acl (
acl => ‘open_acl_file.xml’,
description => ‘A test of the ACL functionality’,
principal => ‘TEST’,
is_grant => TRUE,
privilege => ‘connect’,
start_date => SYSTIMESTAMP,
end_date => NULL);
DBMS_NETWORK_ACL_ADMIN.assign_acl (
acl => ‘open_acl_file.xml’,
host => ‘*’,
lower_port => 1,
upper_port => 9999);

COMMIT;
END;
/

Advertisements