How to compare a JDBC response returned in XML against Rest API result which is in JSON
Hi
I'm using SoapUI open source tool.
I got a response from JDBC DB query which is in XML like below. I need to compare this results against rest service API results which is returned in JSON. The issue is I have more elements in API response, so I'm only keen in checking specific elements present in a specific order. How to achieve this using Groovy script ?
The DB respnse result is like below
<row1>
<plantcode>2343</plantcode>
<plantname>John Plant</plantname>
<category>CT</category>
<sku>23432</sku>
<model>OC59SK11PX1</model>
<productName>Built-in, 7 Function</productName>
<availableStock>7</availableStock>
<availabledate>112890</availaledate>
</row1>
.....
<row2>.....
<row3>.......
The JSON respnose from API is like below
{"records": [{
"firstRecordSKU": "81572",
"firstRecordRowNum": "1",
"lastRecordSKU": "81497",
"lastRecordRowNum": "4",
"totalRecords": "4",
"accountList": [ {
"accountNumber": "657015",
"accountName": "ABC Account",
"wareHouses": [ {
"wareHouseCode": "5912",
"wareHouseName": "Zenith Plant",
"categories": [ {
"categoryDesc": "",
"categoryCode": [
{
"subCategoryCode": "BA",
"subCategoryDesc": "Baring",
"products": [
{
"sku": "24246",
"modelNumber": "OC59SK11PX1",
"productName": "Built-in 50,Pyrolytic",
"availableStock": "10",
"stockInTransit": "5",
"availableFrom": "2018-08-30"
},
{
"sku": "24330",
"modelNumber": "OBE0HL7DEW1",
"productName": "Built-in, 7 Function",
"availableStock": "0",
"stockInTransit": "",
"availableFrom": ""
}
]
},
{
"subCategoryCode": "CT",
"subCategoryDesc": "ClasTolls",
"products": [
{
"sku": "24246",
"modelNumber": "OB60SD11PX1",
"productName": "Class Tool 85L, 11 Function",
"availableStock": "10",
"stockInTransit": "5",
"availableFrom": "2018-08-30"
},
{
"sku": "24330",
"modelNumber": "OB60SL7DEW1",
"productName": "Class Tool 90L, 7 Function",
"availableStock": "0",
"stockInTransit": "",
"availableFrom": ""
}
]
},
{
"subCategoryCode": "OW",
"subCategoryDesc": "Owls",
"products": [
{
"sku": "24246",
"modelNumber": "OB60SD11PX1",
"productName": "Generic Owls 85L, 11 Function",
"availableStock": "10",
"stockInTransit": "5",
"availableFrom": "2018-08-30"
},
{
"sku": "24330",
"modelNumber": "OB60SL7DEW1",
"productName": "Greater Space Owls, 7 Function",
"availableStock": "0",
"stockInTransit": "",
"availableFrom": ""
}
]
}
]
}]
}]
}]
}]}
I need to check all elements in a specific row returned in DB query is matching against API result, how could I achieve this using groovy script ? Any help is highly appreciated..
Thank you