Forum Discussion

mandadavenkat's avatar
mandadavenkat
Occasional Contributor
12 years ago

Compare element values of SOAP Response and JDBC Request

I would like to compare the values of the elements under a node fetched from SOAP response and a JDBC Request.
I'm able to print the values with the below groovy code but failed to compare the same as I'm not very good at coding.

Note: Element names are same but in different order in both the responses.

I would like to compare the values based on the element names from both the responses irrespective of the order of the elements.
Note: Compare only if the JDBC element value is not null.



def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )

def JMSHolder = groovyUtils.getXmlHolder( "SOAPTestStep#Response" )
def JDBCHolder = groovyUtils.getXmlHolder( "JDBC Request step#ResponseAsXml" )

def node1 = JMSHolder.getDomNodes("//ns0:Study[1]/*")
def node2 = JDBCHolder.getDomNodes("//Row[1]/*")

node1.each {
log.info it.QName.getLocalPart()
log.info it.firstChild.nodeValue
}

node2.each {
log.info it.QName.getLocalPart()
log.info it.firstChild.nodeValue

}


I really appreciate your kind help in advance.
No RepliesBe the first to reply