fork(3) download
  1. def str = '''<?xml version="1.0" encoding="UTF-8"?>
  2. <soapenv:Envelope
  3. xmlns:soapenv="http://s...content-available-to-author-only...p.org/soap/envelope/"
  4. xmlns:xsd="http://w...content-available-to-author-only...3.org/2001/XMLSchema"
  5. xmlns:xsi="http://w...content-available-to-author-only...3.org/2001/XMLSchema-instance">
  6. <soapenv:Body>
  7. <ns1:processRequestResponse soapenv:encodingStyle="http://s...content-available-to-author-only...p.org/soap/encoding/"
  8. xmlns:ns1="http://s...content-available-to-author-only...g.com">
  9. <processRequestReturn href="#id0"/>
  10. </ns1:processRequestResponse>
  11. <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://s...content-available-to-author-only...p.org/soap/encoding/" xsi:type="ns2:NIResponse"
  12. xmlns:soapenc="http://s...content-available-to-author-only...p.org/soap/encoding/"
  13. xmlns:ns2="urn:server.ws.ni.vpg.devoteam.com">
  14. <resultOperation xsi:type="xsd:string">0</resultOperation>
  15. <errorCode xsi:type="xsd:string">0</errorCode>
  16. <errorDescription xsi:type="xsd:string">Operazione eseguita con successo</errorDescription>
  17. </multiRef>
  18. </soapenv:Body>
  19. </soapenv:Envelope>'''
  20.  
  21. def xml = new XmlSlurper().parseText(str)
  22.  
  23. def getElementValue = { element -> xml.'**'.find{element == it.name()}?.text() }
  24.  
  25. def resultOperationValue = getElementValue('resultOperation')
  26. def errorCodeValue = getElementValue('errorCode')
  27. println resultOperationValue
  28. println errorCodeValue
Success #stdin #stdout 0.99s 2252800KB
stdin
Standard input is empty
stdout
0
0