I am trying to extract a value from a successful API request, which is sending a XML response, using Postman. Following is the way how I tried to catch the value that I need from the response.
var jsonObject = xml2Json(responseBody);
console.log(jsonObject);
postman.setGlobalVariable("Active_SAML", jsonObject.bankidCollectResponse.SAMLReferens);
console.log(pm.globals.get("Active_SAML"));
That script written inside "Tests" tab and the console log out put is as below.
But when I execute the program, I get following error.
There was an error in evaluating the test script: TypeError: Cannot read property 'SAMLReferens' of undefined
I am not sure where I'm doing it wrong. Can anybody please point out me that?
Thanks to @ChathurangaChandrasekara comment, I did able to figure out the format that they expected.