Communication between Jasper and a different application

849 Views Asked by At

I have Jasper Reports Server (installed on www.example.com) and a separate Java/JSP application (installed on www.example.net), and I am pursuing different options for generating reports.

Option 1 (current working solution)

My current working solution is that the user logs into the Java/JSP application, and selects a report. The application creates an XML representation of the report, which it saves as fileNameXML and then it then sends it to the Jasper Reports Server using code such as the following:

     <IFRAME height="600" width="1000" src="https://www.example.com/jasperserver/flow.html?
    _flowId=viewReportFlow&standAlone=true&_flowId=viewReportFlow&
    ParentFolderUri=%2Freports&
    reportUnit=%2Freports%2FExample_Report_2&j_username=user&
    j_password=password&
net.sf.jasperreports.xml.source=https://www.example.net/<%=fileNameXML%>">                              
     </IFRAME>

(Note that even though I pass a username and password in the URL, security is not compromised because the filenameXML is created using String fileName = UUID.randomUUID().toString() + fileExt;)

Option 2

I connect Jasper Reports server directly to the SQL Server database on www.example.net, and produce reports that way. The disadvantage of this approach is that (a) I would need to set up all the users in Jasper Reports (b) I would need to pass parameters in a security-conscious way so that each user can only access their own data (c) I only have access to the database, and not to the calculations of my application

My Ideal Solution

However I would really like to be able to access the calculations of my application via Jasper, and bypass logging in to my application.

One advantage of this, is that my application does not yet have proper mobile access, and the users could download the Jasper Mobile Application app and access the reports from there.

This would involve the following:

  1. User logs into Jasper
  2. User selects report
  3. Jasper calls my application with certain parameters
  4. Application creates xml file
  5. Application returns a link to this file
  6. Jasper shows report

What is the best way of achieving this?

1

There are 1 best solutions below

2
On

I think the best way to do this is to:

  • Create a URL in your app that is accessible anytime and does not require logging in. If you're using Spring or any other framework, stating that would be good as I could show you how to do this.

There are a lot of ways to skin this cat. Let me know what technologies you're using and maybe we can start from there. We've implemented the requirement you're having right now.

Thank you.