Service Virtualization

 View Only
  • 1.  how to compare xml response with json response

    Posted Oct 10, 2017 02:18 PM

    I am getting XML response from xml step and after i have a REST Step which gives me JSON response having same content but in different order so how to compare the two response.



  • 2.  Re: how to compare xml response with json response
    Best Answer

    Broadcom Employee
    Posted Oct 11, 2017 10:11 AM

    I don't think its possible out of the box  . You can use a JavaScript step to convert the Json response to an XML response and then use the Graphical XML side by side assertion to compare the two.  

    Graphical XML Side-by-Side Comparison - DevTest Solutions - 10.1 - CA Technologies Documentation 



  • 3.  Re: how to compare xml response with json response

    Posted Oct 11, 2017 10:35 AM

    Provided that the xml tag nodes and the json structure is identical (identical meaning same objects...names..values), you can implement a common json-to-xml conversion in a filter (a custom filter) to set a new filter value for comparison to the target xml.

     

    Note that the exact structure may not be the same, as the common conversion apis, wrap the xml in a special tag scheme, but you can override it is needed.