Started work with SoapUI and can't catch idea how to treat Soap responses with Groovy. Currently my project opened in NetBeans and after debuging will be copy-pasted to the SoapUI (eviware) My question is:
def Input = """ <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body>
<ns2:getSalesAuditsResponse xmlns:ns2="http://apidto.dto.t2.wsapi.ng.com/">
<return>
<code>0909019000004830</code>
<realOpenAmount>12</realOpenAmount>
<dueDate>2009-07-11T00:00:00+03:00</dueDate>
</return>
<return>
<code>0909119000006260</code>
<realOpenAmount>55.75</realOpenAmount>
<dueDate>2007-02-11T00:00:00+02:00</dueDate>
</return>
</ns2:getSalesAuditsResponse> </S:Body> </S:Envelope>
"""
How to find "return" Node with specific dueDate ? As I can assume, it can be near next:
def document = new groovy.util.XmlSlurper().parseText(Input);
def sa = document.depthFirst().findAll { it.@dueDate=="2007-02-01T00:00:00+02:00" }
But sa is [] at this case. And after all how to delete found node in original XML ?
I'am trying with XMLHolder, but did not know how to initialize it in Netbeans "context" variable which does existed within SoapUI.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(???context???) def dataHolder = groovyUtils.getXmlHolder( Input ) def data = dataHolder.getDomNode("//return[dueDate="2007-02-11T00:00:00+02:00"]")
And last more general question: Is it possible to debug groovy scripts in NetBeans and use it later in SoapUI 3.0.1 ? Or it is impossible to get code autocomplete and doc on demand for groovy_for_SoapUI ?
Many thanks