using session in GatlingHttpFunSpec

Hi All,

I am new to gatling .Trying to use GatlingHttpFunSpec … I need to use one of the value from response body. when i use exec to get the session value i am getting compilation error error… Any help would be really appreciated.

Error Message: missing parameter type

exec(session => {

Code:

spec{

http(“itemcheck”)
.post(url)
.body(StringBody("" + reqbody+ “”)).asXml
.check(status.is(200))
.check(regex("(.*?)").saveAs(“ItemDet”))
exec(session => {
val ItemS = session(“ItemDet”).asOption[String]
println(ItemS.getOrElse(“COULD NOT ITEM”))
session
})

}

Regard,
Venky