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.

Validation in SOA Test

pri02690
pri02690 Posts: 3

Hi,
Can anyone let me know how to validate multiple items extracted from specific xpath in different orders in LHS and RHS using SOA tool.
Ex: Value is in extracted from JSON and it looks like below
LHS: item1
item3
item2
RHS: item3
item2
item1

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
  • pri02690
    pri02690 Posts: 3

    Link says on converting the entire json to complete xml but I have extracted values from specific key which has multiple values and is not in either json or xml format and want to format the same in xml to use xml sort for comparison.How this can be done?

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited March 2018

    You would need to provide a concrete example so that we better understand what you are doing. For example, the user in that other post submitted a sample JSON document and described what parts needed validation. Depending on your specific case, extracting values at specific indices may be the wrong approach since you would have no idea what you are extracting if the order isn't guaranteed.

    Generally you solve out-of-order problems by sorting the message. You can convert to XML then either use the XML Sort tool or do an XML diff with the "Ignore element order" option. If you you convert to XML then sort the XML, you can even covert it back to JSON again then try doing the original extractions you were attempting, since the order will be guaranteed at that point with the document being sorted.

  • pri02690
    pri02690 Posts: 3

    Hi Ben
    In the given example source and target were constructed json format. In my case extracted fields, Let me know if you have any option to construct as json/xml.

    Example,

    [
    {
    "id":123456
    "customerName": "ppp"
    },
    {
    "id":123456
    "customerName": "rrr"
    },
    {
    "id":123456
    "customerName": "iii"
    },
    {
    "id":123456
    "customerName": "yyy"
    },
    {
    "id":123456
    "customerName": "aaa"
    }]

    i extracts using jsonDataBank \root\id[*]

    How should i extract this as constructed json/xml???

    Thanks
    Priya