Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Storing xml response

api_tester Posts: 28
edited August 2019 in SOAtest

Hi all, I am trying to split an xml response by using a tag but before that I need to store my response xml in a string variable. I am using JavaScript (as per my project requirement) in custom assertion.Please kindly help me how to store the response xml in a string variable first so that i can proceed with further scripting.

I am using
var splitResp = "Response_XML".split(""); //used tag priceList

But it is not able to fetch the response xml first.I am bit new to Parasoft so a little help would mean a lot.


  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited August 2019

    The XML Data Bank should be used to perform extractions from XML documents. The tool lets you extract all or part of the response, which ever part you desire. I recommend avoiding scripting but if you would like to script something then you can indeed reference data source and data bank columns from scripts. See Accessing Data Sources from Scripts.

    There is another alternative. The "custom" assertion is a type of value assertion meaning that it receives the text content of the selected element. However, you can modify the element to use the "serialize" XPath function to return the entire element as text (as opposed to its text content). The first argument to the script will receive the result of the XPath as a string. To modify the XPath click the "Change Element" button then select "Edit XPath Manually". You can wrap the XPath with a "serialize" function like "serialize(/foo/bar)".