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

Hello,

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:

.post("/sap/bc/webdynpro/sap/BS_OVP_BP?sap-contextid=#{cr_sapcontextid}")

Trace log:

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

HTTP request:

POST https://myfioritest.sap-xxxx.xxxx.xxxx.com:44303/sap/bc/webdynpro/sap/BS_OVP_BP?sap-contextid=

Thanks.

Hello,

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.

Cheers

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

request_73:

.post("/sap/bc/webdynpro/sap/BS_OVP_BP?sap-contextid=#{cr_sapcontextid}")

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:

POST https://myfioritest.sap-xxxx.xxxx.xxxx.com:44303/sap/bc/webdynpro/sap/BS_OVP_BP?sap-contextid=

Thanks.

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)?

Cheers!

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
			.get("/sap/bc/ui5_ui5/ui2/ushell/resources/~20230531080900~/sap-ui-version.json")
			.headers(headers_58)
			.resources(http("request_59")
			.get("/sap/bc/webdynpro/sap/BS_OVP_BP?sap-wd-configId=BS_OVP_CU&sap-language=EN&sap-client=100&sap-ui-tech-hint=WDA&sap-ushell-defaultedParameterNames=%5B%22sap-ach%22%5D&sap-ie=edge&sap-theme=sap_fiori_3&sap-target-navmode=inplace&sap-touch=0&sap-ushell-timeout=0&sap-shell=FLP1.84.35-NWBC")
			.headers(headers_59)
			.check(
					regex("sap-contextid=(.*)\" enctype=").saveAs(key = "cr_sapcontextid"),
					css(selector = "input[name='sap-wd-secure-id']", nodeAttribute = "value").saveAs(key = "cr_sapwdsecureid")
				)
				
			http("request_73")
//			.post("/sap/bc/webdynpro/sap/BS_OVP_BP?sap-contextid=SID%3aANON%3aIKAWEQQM1AS01_QM1_22%3aaK-v6QnplCDLHF0WaYdkdVJTo-XrJlYgPs9nhII6-NEW")
			.post("/sap/bc/webdynpro/sap/BS_OVP_BP?sap-contextid=#{cr_sapcontextid}")
			.headers(headers_73)
			.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

Thanks.

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.

Thanks.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.