Correlation value is not passing into POST request URL in gatling scala


I’m facing issue with correlation value since it’s not passing to POST request URL. Getting 500 response due to this. When i checked trace log, the value is printing but it’s not passing to the post request and it’s getting null value into that. Can you pls let me know how to pass this to post request url.

PFB code snippet which we pass the value into request.
code snippet:


Trace log:

sap contextid value--> SID%3aANON%3aIKAWEQQM1AS01_QM1_22%3aaK-v0cVqxAmjhvTxkhcyJ7Pq3-rrJlales9-RB1E-NEW

HTTP request:




If what gets printed in the logs is contextid=, it means that the attribute is defined but contains an empty String.

You should double check how you’re trying to capture this attribute, it’s where your error is.


Hi Stephane,

Thanks for the update.

I’m extracting the below sap context id(cr_sapcontextid) from request_59 and passing this cr_sapcontextid attribute to request_73 which is post request url.

sap contextid –> SID%3aANON%3aIKAWEQQM1AS01_QM1_22%3aaK-v0cVqxAmjhvTxkhcyJ7Pq3-rrJlales9-RB1E-NEW



But when i checked in trace, it won’t be passing the cr_sapcontextid attribute value to above request_73. It shows as below in trace log.

HTTP request:



Hi @Raj007,

How do you “extract” the sap context?
Can you show us the corresponding save("cr_sapcontextid") with the associated check?
Are you sure the value is present in the session (to be readable from the Gatling Expression Language you use in your request_73)?


Hi Sebastien,

Thanks for the reply.

Below is the code snippet for extracting sap context and save into “cr_sapcontextid” attribute.

		.exec(http("nrc_t04_ClickOnManageCustomerTile")	//request_58
					regex("sap-contextid=(.*)\" enctype=").saveAs(key = "cr_sapcontextid"),
					css(selector = "input[name='sap-wd-secure-id']", nodeAttribute = "value").saveAs(key = "cr_sapwdsecureid")
//			.post("/sap/bc/webdynpro/sap/BS_OVP_BP?sap-contextid=SID%3aANON%3aIKAWEQQM1AS01_QM1_22%3aaK-v6QnplCDLHF0WaYdkdVJTo-XrJlYgPs9nhII6-NEW")
			.formParam("sap-charset", "utf-8")
//			.formParam("sap-wd-secure-id", "0A286DD8E3037F745852C6FA13F97FE4")
			.formParam("sap-wd-secure-id", "#{cr_sapwdsecureid}")
			.formParam("fesrAppName", "BS_OVP_BP")
			.formParam("fesrUseBeacon", "true")

and can see the below sap context id value in trace log as well. But it’s not passing to request_73.
Pls let me know is there anything wrong which i did here.

Trace log:
sap contextid value–> SID%3aANON%3aIKAWEQQM1AS01_QM1_22%3aaK-v0cVqxAmjhvTxkhcyJ7Pq3-rrJlales9-RB1E-NEW


Pretty sure that’s exactly what I said: your regex is broken and is capturing an empty String instead of the expected value.
Try using an online Java regex evaluator.

But can see the below capture value for sap contextid in debug log which i’m printing in the script.
This’s what i expected. But the thing is why it’s passing the empty sting to request_73 since we’re capturing below value in “cr_sapcontextid” attribute.

sap contextid value–> SID%3aANON%3aIKAWEQQM1AS01_QM1_22%3aaK-v0cVqxAmjhvTxkhcyJ7Pq3-rrJlales9-RB1E-NEW

The snippet you’ve provided doesn’t compile. You’ve edited it and broken it.
I suspect request_59 and request_73 are both resources of the same request. If so, you have no guarantee that request_73 will be executed after request_59 completes. That’ the whole point of resources: fetched concurrently.
If so, you must move them out of the resources block and execute them sequentially as normal requests.

Will give a try as you mentioned.