2

I am trying to design a report that gets JSON data from a RESTful resource. As far as I understood natively this option isn't available and I have to rely on external classes. I came across this suggestion. I built the necessary jars (basic and dependencies), created a scripted datasource modified the open script then a dataset with fetch script but I cannot get it to work no matter what. All of the time I get the following error:

...................
A BIRT exception occurred. See next exception for more information.
Error evaluating Javascript expression. Script engine error: TypeError: [JavaPackage com.actuate.json.JSONParser] is not a function, it is object. (/report/data-sources/script-data-source[@id="83"]/method[@name="open"]#5)
Script source: /report/data-sources/script-data-source[@id="83"]/method[@name="open"], line: 0, text:
__bm_OPEN(). (Element ID:1)
at org.eclipse.birt.report.engine.script.internal.DtEScriptExecutor.handleJS(DtEScriptExecutor.java:99
................................... 

(I included the most important part of the message)

  1. So what is the cause of such an error? Not loading the class properly? I tried to load the resource from the property box I tried to load the external jars in the classpath I copied the inside the scriptlib folder Nothing worked.

  2. In the open script is necessary to import explicitly all of the dependencies of the target class (despite the fact that the java source code does it already)?

  3. Is there any other way to achieve my objective? (I am banging my head for a couple of days now.....)

Thanks in advance

Community
  • 1
  • 1
spiros
  • 21
  • 1
  • 3

1 Answers1

0

If the JSON data are provided by Java backend using JAXB you can easily provide an XML response. Within BIRT use XML source pointing to your URL. Now an assistent will let you define the xpath expressions to transform the XML stream into an dataset. Based on this you can build your report.

David
  • 3,388
  • 2
  • 21
  • 25