Gatling - How to use feeder in a post body which is using raw XML file

I need to use a raw xml file as body in one of my gatling script. in this how we can try feeder.

Tried including variable name in raw file. including feeder in scala code. this didn’t worked.

this is the code in scala

val feeder = csv("data.csv")

val scn = scenario("RecordedSimulation")
        .feed(feeder)
        .during(10 seconds)
        {
        exec(http("request_0")
            .post("/MED/01_WS/phoenixxm.asmx")
            .headers(headers_0)
            .body(RawFileBody("RecordedSimulation_0000_request.txt")))
            .pause(200.milliseconds)
        }

How we can do parametrization in rawfilebody implimentation

You have to specify the content type along with RawFileBody.

e.g. RawFileBodyPart(“file”, RecordedSimulation_0000_request.txt.xls").contentType(“application/vnd.ms-notepad”).fileName(“RecordedSimulation_0000_request.txt.xls”))

Instead, I would suggest to build string variable and send as request body.

e.g. : .body(StringBody("""{ “myContent”: “${myDynamicValue}” }""")).asJSON

Create a string out of rawfile which is having xml body

Hi Madhan,

i my case its a huge XML, i dont think its easy to put as you mentioned. How i can submit a 50+ lined xml ? can you give me a example.
also if i use “RawFileBodyPart” can i include the variable in the file and get used while execution?

please share your valuable suggestions on this.

Thanks,
Karthik MA

Hi Karthik,

Try using .body(ElFileBody(“RecordedSimulation_0000_request.txt”)

This worked, thanks Vikram