I have been trying to capture the request and response payloads of a RESTful webservice in the SOAP-UI test runs, via. the use of DataSink.
In order to visualize, the set up is as below:
Properties in the DataSink (as Subreport) have also been set as seen below :
Next, I created a subReportnamed it UniRestService. Below is the code :
SubReport Name: UniRestService
ReportType: TestCase
Scope: Project
DataSource: Data Sink
<jasperReport xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report name" language="groovy" pageWidth="535" pageHeight="842" columnWidth="535" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><template>"../../styles.jrtx"</template><field name="sessionId" class="java.lang.String"/><field name="request" class="java.lang.String"/><field name="response" class="java.lang.String"/><columnHeader><band height="37"><staticText><reportElement style="SmallHeader" x="0" y="0" width="535" height="34"/><textElement textAlignment="Left" verticalAlignment="Middle"><font size="14" isBold="true" isUnderline="true"/></textElement><text>API Execution Details</text></staticText></band></columnHeader><detail><band height="120"><staticText><reportElement x="0" y="0" width="67" height="20"/><textElement><font isBold="true" isUnderline="true"/></textElement><text>Session ID</text></staticText><textField isStretchWithOverflow="true"><reportElement x="67" y="0" width="100" height="20"/><textFieldExpression>$F{sessionId}</textFieldExpression></textField><staticText><reportElement x="0" y="20" width="67" height="20"/><textElement><font isBold="true" isUnderline="true"/></textElement><text>Request :</text></staticText><textField isStretchWithOverflow="true"><reportElement x="67" y="20" width="468" height="20"/><textFieldExpression>$F{request}</textFieldExpression></textField><staticText><reportElement x="0" y="40" width="67" height="20"/><textElement><font isBold="true" isUnderline="true"/></textElement><text>Response:</text></staticText><textField isStretchWithOverflow="true"><reportElement x="67" y="40" width="468" height="20"/><textFieldExpression>$F{response}</textFieldExpression></textField></band></detail></jasperReport>
Next, I created the the main report named : test, Below is the configuration screenshot:
And the correponding code is below :
<jasperReport xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="ReportTemplate" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="30" bottomMargin="30" xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><template>"../../styles.jrtx"</template><!--FIELDS & PARAMS--><title><band height="70"><textField><reportElement x="159" y="13" width="229" height="42"/><textElement><font size="26"/></textElement><textFieldExpression class="java.lang.String">$F{name} + " Report"</textFieldExpression></textField></band></title><pageHeader><band/></pageHeader><detail><band height="122"><!--SUBREPORTS UNDER HERE--><subreport isUsingCache="true"><reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="0" width="500" height="30"/><dataSourceExpression><![CDATA[$P{dataSink}]]></dataSourceExpression><subreportExpression><![CDATA["subreport:UniRestService"]]></subreportExpression></subreport></band></detail></jasperReport>
I have also tried with the the following dataSourceExpression in the code snippet above :
<dataSourceExpression><$P{dataSink}></dataSourceExpression><subreportExpression><"subreport:UniRestService"></subreportExpression>
In either cases, I get the following error, from the error.log.
Sun Nov 01 10:44:10 EST 2015:ERROR:net.sf.jasperreports.engine.design.JRValidationException: Report design not valid : 1. Parameter not found : dataSink net.sf.jasperreports.engine.design.JRValidationException: Report design not valid : 1. Parameter not found : dataSink at net.sf.jasperreports.engine.design.JRAbstractCompiler.verifyDesign(JRAbstractCompiler.java:258) at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:140) at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:215) at com.eviware.soapui.reporting.engine.jasper.GenerateJasperReport.createReport(SourceFile:409) at com.eviware.soapui.reporting.engine.jasper.GenerateJasperReport$ReportFillWorker.construct(SourceFile:382) at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46) at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:131) at java.lang.Thread.run(Unknown Source)
Any help is much appreciated here.
Thanks in advance.