How to multiuply times the same type in request soap mock service groovy ?
How to send multiply time the same type in request soap mock services
<invoiceDatas> <!--Zero or more repetitions:--> <invoiceData> <id>?</id> <MPK>?</MPK> <RK>?</RK> <value>?</value> </invoiceData> </invoiceDatas>
i alwyas can send one row with this, but how to change to send for example 3 rows cans omeone explain in response i should have
<invoiceDatas> <!--Zero or more repetitions:--> <invoiceData> <id>?</id> <MPK>?</MPK> <RK>?</RK> <value>?</value> </invoiceData> <!--Zero or more repetitions:--> <invoiceData> <id>?</id> <MPK>?</MPK> <RK>?</RK> <value>?</value> </invoiceData> <!--Zero or more repetitions:--> <invoiceData> <id>?</id> <MPK>?</MPK> <RK>?</RK> <value>?</value> </invoiceData> </invoiceDatas>
i have groovy script which looks that
def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent )
// get arguments
def fkId = Integer.parseInt( holder["//fkId"] )
def dateTime = holder["//dateTime"]
def status = holder["//status"]
def id = holder["//id"]
def MPK = holder["//MPK"]
def RK = holder["//RK"]
def value = holder["//value"]
def pid = Integer.parseInt( holder["//pid"] )
def type = holder["//type"]
def valueTotal = Float.parseFloat(holder["//valueTotal"])
//context.operationLogs += 'fkId: '+fkId + 'dateTime: '+ dateTime + 'status:' + status+' id: ' + id + 'MPK:'+ MPK +'RK:'+ RK + ' value:' + value +'pid:' + pid +'type:' + type + 'valueTotal:' + valueTotal
context.operationLogs += fkId
context.operationLogs1 += dateTime
context.operationLogs2 += status
context.operationLogs3 += id
context.operationLogs4 += MPK
context.operationLogs5 += RK
context.operationLogs6 += value
context.operationLogs7 += pid
context.operationLogs8 += type
context.operationLogs9 += valueTotal
requestContext.result1 = fkId
requestContext.result2 = dateTime
requestContext.result3 = status
requestContext.result4 = id
requestContext.result5 = MPK
requestContext.result6 = RK
requestContext.result7 = value
requestContext.result8 = pid
requestContext.result9 = type
requestContext.result10 = valueTotal
requestContext.result = [fkId, dateTime,status,id,MPK,RK,value,pid,valueTotal ]
context.fkId = context.operationLogs.size
context.fkId = context.operationLogs1.size
context.fkId = context.operationLogs2.size
context.fkId = context.operationLogs3.size
context.fkId = context.operationLogs4.size
context.fkId = context.operationLogs5.size
context.fkId = context.operationLogs6.size
context.fkId = context.operationLogs7.size
context.fkId = context.operationLogs8.size
context.fkId = context.operationLogs9.size
my response is thaht
<ResponseMessageAdd>
<fkId>${result}</fkId>
<dateTime>${result1}</dateTime>
<status>${result2}</status>
<invoiceDatas>
<!--Zero or more repetitions:-->
<invoiceData>
<id>${result3}</id>
<MPK>${result4}</MPK>
<RK>${result5}</RK>
<value>${result6}</value>
</invoiceData>
<invoiceData>
<id>${result3}</id>
<MPK>${result4}</MPK>
<RK>${result5}</RK>
<value>${result6}</value>
</invoiceData>
</invoiceDatas>
<payments>
<pid>${result7}</pid>
<type>${result8}</type>
<valueTotal>${result9}</valueTotal>
</payments>
</ResponseMessageAdd>
<!--Optional:-->
<Reference>${result}</Reference>