问题
I am having my API where I am sending a request from POSTMAN and it takes less than a second to respond. But, when I use the same API in JasperReport using JSON DataAdapter, it takes about 7 to 15 seconds to respond and generate the report. Here is a snapshot is taken after uploading the report to the server using Mozilla.
Here is the same report on the POSTMAN
It is not fetching anything from the API but just the login key. Here is a snapshot from the JasperStudio
Here is my jrxml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.10.0.final using JasperReports Library version 6.10.0-unknown -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="test_A4" language="javascript" pageWidth="595" pageHeight="200" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="8fe94703-075f-4ae1-affc-bff8d7a8a4b8">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="POST_REQUEST_TO_GET_TOKEN"/>
<property name="ireport.jasperserver.url" value="http://server_address:port/jasperserver/"/>
<property name="ireport.jasperserver.user" value="user"/>
<property name="ireport.jasperserver.reportUnit" value="/Sub_Reports/test_A4"/>
<property name="ireport.jasperserver.report.resource" value="/Sub_Reports/test_A4_files/main_jrxml"/>
<property name="net.sf.jasperreports.data.adapter" value="POST_REQUEST_TO_GET_TOKEN.xml"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/>
<queryString language="JSON">
<![CDATA[]]>
</queryString>
<title>
<band height="59" splitType="Stretch">
<textField>
<reportElement x="0" y="0" width="555" height="59" uuid="691c8e97-8888-4786-9350-62d5f187820b"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="19" isBold="true" isItalic="false"/>
</textElement>
<textFieldExpression><![CDATA["This is a drill down sample report"]]></textFieldExpression>
</textField>
</band>
</title>
<summary>
<band height="75" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="555" height="50" uuid="4aba0c46-cda3-4611-97a2-1f446bd4f85b"/>
<textElement>
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[It sends a POST request to an API and receives a token to put it into another POST request which will bring back the data from the API]]></text>
</staticText>
<textField>
<reportElement x="0" y="45" width="555" height="30" uuid="447eee49-5f57-4280-8f47-f5a5a8ff6503"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="16" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA["This is in sub-reprots directory"]]></textFieldExpression>
</textField>
</band>
</summary>
</jasperReport>
I am unable to get the cause of many delays. Would anyone please help me figure this out? Thanks a lot.
I am using JasperSoft Studio 6.10 and JasperServer Version 7.
来源:https://stackoverflow.com/questions/65201117/json-dataadapter-using-api-causing-slow-report-generation