我有下面的groovy腳本,我在groovyconsole中運行,它運行得很好。我在xml響應中查找特定節點的子節點數,併爲每個子節點輸出所需的值。如何在soap中使用XmlSlurperUI
def path = new XmlSlurper().parse(new File('C://SoapUI//ResponseXML/Response.xml'))
NumberOfPositions = path.Body.GetPositionsAggregateResponse.GetPositionsAggregateResult.AccountPositions.Securities.Positions.children().size()
for(def i=0; i<NumberOfPositions; i++){
println i
println path.Body.GetPositionsAggregateResponse.GetPositionsAggregateResult.AccountPositions.Securities.Positions.PositionSummary[i].Legs[0].PositionAggregate[0].PositionID[0].text()
println path.Body.GetPositionsAggregateResponse.GetPositionsAggregateResult.AccountPositions.Securities.Positions.PositionSummary[i].Legs[0].PositionAggregate[0].AccountID[0].text()
}
我想在soapUI的執行相同的任務,但無法得到它的工作使用groovyutils這裏提到:http://www.soapui.org/Scripting-Properties/tips-a-tricks.html
1)我如何解析從我的請求的XML響應的XmlSlurper? def path = new XmlSlurper()。parse(?)
2)我是否可以在soapUI中使用上面相同的代碼?
任何幫助表示讚賞。謝謝!