I am trying to use data (SOAP Request body) from text file stored on my local machine. and then using this to be passed to the body of my https request. Getting 500 error while trying to execute it. I am sure there is issue with way file variable is being used here. Could someone please help me with this issue?
`
package computerdatabase
import scala.io.Source
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class BasicSimulation3 extends Simulation {
val httpProtocol = http
.baseUrl(“https://abc.com”) // Here is the root for all relative URLs
val fc = Source.fromFile("/Users/vsinh/Documents/samplesoap.rtf").getLines.mkString
val header = Map(
“Content-Type” → “application/soap+xml;charset=UTF-8”,
// “accept-encoding” → “gzip, deflate”,
// “SOAPAction” → “”, “Content-Length” → “275”,
// “Host” → “PUNITP83267L:8081”,
“Connection” → “alive”,
// “accept-language” → “en-US,en;q=0.8”,
“User-agent” → “Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0”)
object payload_1{
val pl1 = exec(session => session.set(“fc”, fc))
.exec(http(“IVR1”)
.post("")
.headers(header)
.body(StringBody("""${fc}""")))
}
val scn1 = scenario(“SoapTest1”).exec(payload_1.pl1) // A scenario is a chain of requests and pauses
`