The following steps take the Connect request as an example, and the session ID has already been correlated.
-
Add scripts in the Connect for capturing the transaction ID and assign it to a parameter.
A ConnectAndCreateTransaction request looks like the following:
web_custom_request("ConnectAndCreateTransaction", "URL=http://192.168.178.125:5001/api/ServerApi/ConnectAndCreateTransaction", "Method=POST", "Resource=0", "RecContentType=application/json", "Referer=", "Snapshot=t275.inf", "Mode=HTTP", "EncType=application/json;charset=UTF-8", "Body={\"version\":\"1.0\",\"requestid\":\"667FF1FE-77F8-40b6-869E-EA90D466B504\", \"appname\":\"psapi4loadrunner\",\"namespace\":\"Psapi4loadrunner\",\"session\":\"" "<gs_SessionID>\",\"type\":7,\"transaction\":null,\"content\":{\"connect" "\":{\"cachegroup\":\"\",\"cachename\":\"\",\"transactionname\":\"sqlca\",\"params\":\"" "eyJ0aW1lc3RhbXAiOjE2MjUyMDM0OTMsInBheWxvYWQiOiJjNjJLb3BST1pMVVBuZVc4NXk5bUgzb1RvOXI1NSs rR05UTC90S2wyR2lubExleE1CdCtVaGttRWJtd2N2Um5vVTlBejBCbDV3Mlh0aW5zYi80SU9jQW5uc2hqNXdSbUt 0ZGx0UlJkeVllSCtEU1JTc1ZNVjd5SmttTnBTdHpoZnZHK3Z0RnhJWE1JczZHRzh5QVJsd2U1WlJ3VEFUVmIxeFF rZnl3MXdOc1ZUeFNGMDNsb2UwMlZXVU1JOUU5MzhuTHhoaXRxMElmTTZjaVhST21la2xMaEh6ZkREcm1tc3RWYVU 4OWhuY2ZZNU5oaXdtMHFnYkowY2Fsdmp6OENOcjhmVHpZR1BmQ0UxZW1YZ3lkNG8vUT09Iiwic2lnbmF0dXJlIjo idFkwVDlURUxYY0tOTEhBdmZzQUNOQ0tuRWtlRUtKNEFMSnBsamJ1aFRtYk92dU" "FhSnBrNXlLMTBhMEtiMzQ1dkc4Vm9tRTJZaG9Kb0FnbUlOaHF1cWc9PSJ9\"}}}", LAST);
You need to add the following code above the ConnectAndCreateTransaction request:
-
Add a web_reg_save_param function above the request to capture the transaction ID and assign it to the parameter “gs_TransactionID”.
web_reg_save_param("gs_TransactionID","LB=\"transactionid\":\"","RB=\"},\"content","Search=Body",LAST);
-
-
Replace the transaction ID with the parameter every time it occurs.
-
Identify the transaction ID that needs to be correlated. You may do a global search in the script for “transactionid” which is followed by the transaction ID. Ensure that there is no confusion between the current transaction ID and the other ones.
-
Replace every occurrence of the transaction ID with the parameter <gs_TransactionID>.
web_custom_request("RetrieveWithParm", "URL=http://192.168.178.125:5001/api/ServerApi/RetrieveWithParm", "Method=POST", "Resource=0", "RecContentType=application/json", "Referer=", "Snapshot=t279.inf", "Mode=HTTP", "EncType=application/json;charset=UTF-8", "Body={\"version\":\"1.0\",\"requestid\":\"014DD22B-11AB-4238-88D1-7892060396AD\",\"appname\": \"psapi4loadrunner\",\"namespace\":\"Psapi4loadrunner\",\"session\":\"""<gs_SessionID>\", \"type\":1,\"transaction\":{\"transactionid\":\"""<gs_TransactionID>\",\"transactionname\ ":\"sqlca\"},\"content\":{\"retrieves\":[{\"retrieveid\":\"014DD22B-11AB-4238-88D1-789206 0396AD\",\"parent\":\"\",\"dataobject\":\"d_customers\",\"parentcolumn\":\"\",\"isreport\": false,\"isdynamic\":false,\"dwsyntax\":\"\",\"sql\":\"\",\"processing\":1,\"arguments\":[]}]}}", LAST);
-