Search code examples
oracle-apexjasperserver

Integration of APEX and JasperServer


I'm trying to launch jasperreports (on jaspersoft server) via APEX dynamic actions. When I am executing this i receive a error:

enter image description here

Even when I'm only trying to login

DECLARE

  v_blob                 BLOB;
  v_file_name            VARCHAR2 (25) := 'TestReport.pdf';
  v_vcContentDisposition VARCHAR2 (25)  := 'inline';

  v_invoice_id VARCHAR2(10) := :INVOICE_ID; -- your NumberField Item
  v_hostname   VARCHAR2(30) := #HOST#; -- your hostname, eg: localhost
  v_port       NUMBER       := #PORT#; -- port for your JasperReports Server, eg: 8081
  v_username   VARCHAR2(50) := 'jasperadmin'; -- jasperreports server username 
  v_password   VARCHAR2(50) := 'jasperadmin'; -- jaspereports server password

  v_jasper_string VARCHAR2(30) := v_username || ';' || v_password;

  v_login_url  VARCHAR2(100) := 
    'http://' || v_hostname || ':' || v_port || '/jasperserver/rest/login';
  v_report_url VARCHAR2(100) := 
    'http://' || v_hostname || ':' || v_port || '/jasperserver/rest_v2/reports/Reports/' || v_file_name;

BEGIN

  -- log into jasper server
  v_blob := apex_web_service.make_rest_request_b(
    p_url => v_login_url,
    p_http_method => 'GET',
    p_parm_name => apex_util.string_to_table('j_username;j_password',';'),
    p_parm_value => apex_util.string_to_table(v_jasper_string,';')
  );  APEX_APPLICATION.STOP_APEX_ENGINE;

EXCEPTION
  WHEN OTHERS THEN
    RAISE;

END;

The APEX and JasperServer are on different ports.


Solution

  • Problem was with the https protocol. Apex had https and Jasperserver didn't. The conclusion is that both (apex and jasperserver) need to have https.

    Edit: In addittional I needed to create proper ACL and create Oracle Wallet to avoid "Certificate Validation Error"