Hi,
How to I achieve this in Gatling (with reference to the code below):
1/Append to a session Map as we go through chain of execs
2/Use a session Map value in http call body or header.
for e.g. :
I’d like to use PERSON_INFO_MAP(“payloadMDM”) in the subsequent subsequent http .body,
and subsequently 'wd like to capture the response (.check(bodyString.saveAs(“soapReply”))), and append to the same session map like say append (“soapReplyXML”, "soapReply)
to PERSON_INFO_MAP, which can be used as payload in some subsequent api call.
Thank you
shree
//part of .exec(session=>{ function
var payload=Payloads.requestMDM//a XML String
val PERSON_INFO_MAP = Map(
(“firstName”, firstName.trim()),
(“lastName”, lastName.trim()),
(“middleName”, middleName.trim()),
(“company”, company),
(“state”, state),
(“city”, city),
(“addressLine”, addressLine.trim()),
(“zip”, zip.trim()),
(“email”, email.trim()),
(“username”, username.trim()),
(“phoneNo1”, “858-215-5555”),
(“phoneNo2”, “858-215-5553”),
(“acName”, acName),
(“country”, “US”),
(“payloadMDM”,payload)
);
session.set(“PERSON_INFO_MAP”,PERSON_INFO_MAP);
})
.exec(
http(“my_call”)
.post(“http://ffgprf.bosptc.abcs.net:80/ora/default/abcsService/1.0”)
.header(“Content-Type”," text/xml; charset=UTF-8")
.header(“SOAPAction”,“syncAccount”)
.body(StringBody("""${session(“PERSON_INFO_MAP”).asMap[String, String]}""")) //------->>>>>>This throws ERROR !!!
.check(status.is(200))
.check(bodyString.saveAs(“soapReply”))
//------>>would like to append this response as key to the PERSON_INFO_MAP
//—>> to be used as input to subsequent api call. This resets the session. I loose PERSON_INFO_MAP !!!
)