Gatling 2.0.3 - Mapping values to template

Hi All,

I am trying to Map values to the templete. I am testing web services. I need to populate response from the first rest call to another rest call as a request. I am doing in the below.

The RED color is the first POST call and I am saving the response into two values. Now I am passing the values to another POST call in YELLOW color.

I am getting the below error. Please help to solve this issue
too many arguments for method body: (bd:io.gatling.http.request.Body)io.gatling.http.request.builder.HttpRequestWithParamsBuilder

val authorization = scenario(“Authorization”)
.feed(correlationIdFeeder)
.feed(dataFeeder)
.feed(csvFeeder)
.exec(
http(“Creating tm token given an external token”)
.post(tokenization_endpoint)
.body(ELFileBody(“tokenization.json”)).asJSON
.check(status.is(200))
.check(jsonPath("$.payment_token").saveAs(“payment_token”))
.check(jsonPath("$.payment_transaction_id").saveAs(“payment_transaction_id”))
)
.exec(
http(“Authorization flow”)
.post(authorization_endpoint)
.body(ELFileBody(“authorization.json”), Map(“payment_token” → “${payment_token}”, “payment_transaction_id” → “${payment_transaction_id}”, “transaction_date” → “${current_date}”, “value” → “${amount}” ) ).asJSON
.check(status.is(200))
.check(jsonPath("$.transaction_details.transaction_status").is(“Approved”))
.check(jsonPath("$.transaction_details.transaction_status_code").is(“0x20”))
.check(jsonPath("$.transaction_details.payment_token").is("${payment_token}"))
.check(jsonPath("$.transaction_details.payment_transaction_id").is("${payment_transaction_id}"))
.check(jsonPath("$.transaction_details.transaction_date").is("${current_date}"))
)

Thank You
Murali.

Error says it all. .body only takes one argument but you are passing two.

You can include all payment in the request body file. ElFilebody is used when you want to programmatically change parameters.

Can you share me how to write.

Sure

Here is an example

val scn = scenario("xxxx")
  .feed(xxxEntryFeeder)
  .exec(http("Submit JSON")
  .post("""http://sxxx.....""")
  .headers(headers_17)
  .body(ELFileBody("CreateNonxxxx_request_0018.txt")).asJSON
  .resources(http("request_18")
    .get(uri1 + """/xxxxx"""))
  )

In the request body, i.e. CreateNonxxxx_request_0018.txt

Notice how Gatling EL take those values from and parameter-ize it.

{ "Id": "", "ActivityDate": "${ActivityDate}", "MatterId": "${MatterId}", "StaffRef": "${StaffRef}", "TimeSpent": "${TimeSpent}", "ActivityRef": "${ActivityRef}", "ActivityDescription": "", "ActivityComment": "${ActivityComment}", "ActivityCommentMarkup": "", "BillableEntityRef": "${BillableEntityRef}", "BillableEntityDescription": "", "RiskAreaDescription": "", "RoleDescription": "", "StatusDescription": "", "ReviewComment": "", "BillingPeriod": "", "Summary": "${Summary}" }

Thank You. Its working.