Hi,
The way how you configured the RDC DPH it looks to me the property would be called "AuthorizationAuthorizationAuthorization_val"
Because
- you defined "Authorization" as pre-fix
- "Authorization" is the name of the metadata argument itself
- you defined "Authorization_val" as post-fix
Try the RDC DPH with
- prefix: <blank>
- postfix: _val
then the name will be "Authorization_val" and your original scripts should work:
var strauthorization = testExec.getStateValue("Authorization_val");
strauthorization = strauthorization.substring(7, strauthorization.length());
testExec.setStateValue("strauthorization",strauthorization);
------------------------------
Cheers,
Danny
------------------------------
Architect
HCL Enterprise Studio
------------------------------
------------------------------
Original Message:
Sent: 05-26-2020 10:00 AM
From: Raghu Krishna
Subject: Execute script (JSR-223) – Created script to slice request header value is not working, Please help
Hi Danny,
I have tried using Data Copier DPH. I am not able to understand where is the issue.
I have attached print screens of VSI and VSMs from Workstation. Request you to suggest me what is going wrong.
Thanks & Regards, Raghu!!
Original Message:
Sent: 05-26-2020 08:22 AM
From: Danny Saro
Subject: Execute script (JSR-223) – Created script to slice request header value is not working, Please help
Hi,
Logs states:
... : strauthorization .length ( )
Target exception: java.lang.NullPointerException: Null Pointer in Method Invocation
So, it seems that the property "Authorization_val" does not exist at the time when this script is executed. Can you let us know by what method did you get the value of header "Authorization" into the property with name "Authorization_val"?
The header values are found in the metadata property list of the incoming request object (lisa_vse_request) and a Request Data Copier DPH would have been the easiest way to copy the value into a property inside TestExec.
------------------------------
Cheers,
Danny
------------------------------
Architect
HCL Enterprise Studio
Original Message:
Sent: 05-26-2020 07:53 AM
From: Raghu Krishna
Subject: Execute script (JSR-223) – Created script to slice request header value is not working, Please help
Request
GET /REST/SO?searchDate=2020-05-19
Authorization: security 123456
Expected Response
{
"id": "123456", (This value is from request header with "security" string removed)
}
I have created below JSR Script after VS Image Response Selection
---------------------------------------------------------------------------------------------------
var strauthorization = testExec.getStateValue("Authorization_val");
strauthorization = strauthorization.substring(7, strauthorization.length());
testExec.setStateValue("strauthorization",strauthorization);
------------------------------------------------------------------------------------------------------
This script is not working and attached is the log file from inspection view
Kindly help to solve this issue.