Forum Discussion
nmrao
9 years agoCommunity Hero
Here is the groovy script :
//assign response data for below two statements, not done here to save space
def soapResponse =
def jdbcResponse =
def getDetails = { data, recordElement, id, name ->
new XmlSlurper().parseText(data).'**'.findAll{it.name() == recordElement && !it."$id".isEmpty()}.inject([:]){map,item -> map[item."$id".text()] = item."$name".text();map}.sort()
}
def soap = getDetails(soapResponse, 'item', 'category_id', 'category_name')
log.info "Soap response details : $soap"
def jdbc = getDetails(jdbcResponse, 'Row', 'CATEGORY.CAT_ID', 'CATEGORY.CAT_NAME')
log.info "Jdbc response details : $jdbc"
assert soap == jdbc, 'both are not matching'
You can quickly try online demo with your responses.
Also the same script is available at github