Problem passing external parameters to XML Document Data Adapter

1

I have problems trying to generate a report using a "XML Document" Data adapter (remote) that uses some external parameters as input data.

I have defined the external parameters "NAME" and "AGE" but when I try to add them to the POST message body (free text) with "$P{NAME}" and "$P{AGE}" it doesn't replace the placeholders with the actual values of the parameters.

This is the XML Source of the "XML Document" data adapter:

<?xml version="1.0" encoding="UTF-8" ?>
<xmlDataAdapter class="net.sf.jasperreports.data.xml.XmlDataAdapterImpl"><name>xml</name><dataFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="httpDataLocation"><method>POST</method><url>http://myendpoint.com/myendpoint.php</url><username></username><password></password><body><?xml version='1.0' standalone='yes'?>
<contact>
  <name>$P{NAME}</name>
  <age>$P{AGE}</age>
</contact></body><header><name>Content-Type</name><value>text/xml</value></header></dataFile><useConnection>true</useConnection><namespaceAware>false</namespaceAware><selectExpression></selectExpression><locale xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://java.sun.com" xsi:type="java:java.lang.String">es_ES</locale><timeZone xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:java="http://java.sun.com" xsi:type="java:java.lang.String">Europe/Paris</timeZone></xmlDataAdapter>

Exactly the same WORKS if I use the WebService Data Adapter plugin but doesn't work with the native "XML Document" Data Adapter.

What am I doing wrong?

rgrico's picture
7
Joined: May 21 2019 - 1:28am
Last seen: 1 year 1 month ago

I've edited the initial sample to use a more simple syntax

rgrico - 1 year 8 months ago

1 Answer:

0

Hi, 

I have the same problem. Did you solve it?

emanuele.a89's picture
Joined: Dec 12 2017 - 8:49am
Last seen: 3 months 1 week ago
Feedback
randomness