Forum Discussion
LucMertensSteri
12 years agoNew Contributor
Thanks Rao,
based on your comment, I wrote this code and it works fine:
//declare namespace soapenv="http://schemas.xmlsoap.org/soap/envelope/";
//declare namespace glob="http://sap.com/xi/SAPGlobal20/Global";
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holderIn = groovyUtils.getXmlHolder( "Create request With Var#Request" )
def holderOut = groovyUtils.getXmlHolder( "Cancel with parameter#Request" )
// loop item nodes in response message
def aantal = holderIn["count(//MeterReadingDocument/ID)"]
log.info "aantal: $aantal"
def teller = 0
for( item in holderIn.getNodeValues( "//MeterReadingDocument/ID" ))
{
teller = teller + 1
holderOut.setNodeValue("//soapenv:Envelope/soapenv:Body/glob:SmartMeterMeterReadingDocumentERPCancellationRequest/MeterReadingDocument/ID[$teller]",item)
}
based on your comment, I wrote this code and it works fine:
//declare namespace soapenv="http://schemas.xmlsoap.org/soap/envelope/";
//declare namespace glob="http://sap.com/xi/SAPGlobal20/Global";
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holderIn = groovyUtils.getXmlHolder( "Create request With Var#Request" )
def holderOut = groovyUtils.getXmlHolder( "Cancel with parameter#Request" )
// loop item nodes in response message
def aantal = holderIn["count(//MeterReadingDocument/ID)"]
log.info "aantal: $aantal"
def teller = 0
for( item in holderIn.getNodeValues( "//MeterReadingDocument/ID" ))
{
teller = teller + 1
holderOut.setNodeValue("//soapenv:Envelope/soapenv:Body/glob:SmartMeterMeterReadingDocumentERPCancellationRequest/MeterReadingDocument/ID[$teller]",item)
}