error while trying to feed csv data into xml request

I have a requirement to execute my xml payload over set of data. So I would like to feed data set from csv and that’s where I need some assistance. I have attached the code below. Any inputs would be highly appreciated!

My data file - test.csv is stored under src/test/resources/data. It got only one column for now -“eff_date”

Scala code: (it’s not the full code but the code for object where I am feeding the data from csv)

`

class FXISimulation extends Simulation {

val httpProtocol = http
.baseUrl(“https://abc.com”) // Here is the root for all relative URLs

val header = Map(
“Content-Type” → “application/soap+xml;charset=UTF-8”,
“Connection” → “alive”,
“User-agent” → “Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0”)

val data = csv(“test.csv”).circular

object payload_myUHC{
val pl1 = scenario(“pl1test”).feed(data).exec(http(“myUHC_dentalbenefitsandaccums”)
.post(“xyz”)
.headers(header)
.body(StringBody("""<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap=“http://abc.org/”>
soap:Header/
soap:Body
tem:Execute

tem:pcsRequest<![CDATA[ Facets FXIGUESTM HealthWeb 12345 14:20 ePlan scs_benefit InvokeSPUnaware fakpfpr0fxi scs A10000 **"${eff_date}"<****/Column>** * 0 Y 123000 ]]></tem:pcsRequest>
</tem:Execute>
<tem1:Execute xmlns:tem1=“http://tempuri.org/”/></soap:Body>
</soap:Envelope>""")))}

`

Error Details: I am sure I must be missing something above the way I am using data from csv. I am getting the following error

14:27:36.635 [WARN ] i.g.h.e.r.DefaultStatsProcessor - Request ‘myUHC_dentalbenefitsandaccums’ failed for user 291: status.find.in(200,201,202,203,204,205,206,207,208,209,304), found 500

Looks like invalid XML payload to me: the tem namespace is not defined.
Make sure you can validate your payload with an online XML formatter, eg: https://www.freeformatter.com/xml-formatter.html

Hi Stephane,

Appreciate your response! Actually XML is valid and working fine at my end when I am using it with fixed data. I get issue when I try to use csv to feed data to the script. I have just masked the protected data in the script which i have shared here. I was wondering if there is something wrong with the way i have used feeder here.

Thanks,
Vikram

Are your really sure those double quotes should be here?
>"${eff_date}"<****/Column>

Thanks Stephanie, that was the issue! Quick followup question - If we have two columns in the same csv file (eff_date and freq) and i use those columns in the same manner as I have used above, would they be iterated over the same row for both the columns or at random? For example, in the following table - would my gatling script use eff_date and freq from the same row if I am NOT using random? (2019 -12, 2020 - 10, and so on…)

eff_date | freq
2019 | 12
2020 | 10
2021 | 11
2022 | 9

Thanks,
Vikram