30 Mar 2022 03:09 PM - last edited on 31 Mar 2022 08:59 AM by MaciejNeumann
Hi,
I have a HTTP Check in which I receive the response in XML format. However, I need to use that response in a post-execution script to launch a second request to other HTTP web service.
I have read that Json in the only format in which we could use the post-execution script. So, Is there any way to convert the XML response to a JSON format in the "post-execution script" that we could add in a Http monitor?.
Thanks
Carlos
Solved! Go to Solution.
30 Mar 2022 04:46 PM
Hi Carlos,
you should be fine working with xml without converting it. This is a snippet I used for finding a string in an xml response:
var body = response.getResponseBody();
PubDateString = body.match(/<pubDate>(.*?)<\/pubDate>/g)[0];
api.info("PubDateString is : "+PubDateString);
17 Oct 2022 08:47 PM
This solution worked for me to parse some SOAP/XML.
I wish Dynatrace would update their documentation to tell you all the methods that work in the pre & post-execution boxes for synthetics. It frustrating that you have to come to the community to find out that certain javascript methods work in the boxes. Just tell us up front. The documentation for working with JSON is pretty good.