import groovy.xml.XmlSlurper;
import groovy.xml.XmlUtil;
//XmlSlurper (boolean validating, boolean namespaceAware)
var rootNode = new XmlSlurper(false, true).parseText(responseBodyTextToClient).declareNamespace('soapenv':'http://schemas.xmlsoap.org/soap/envelope/' , 'ns1':'http://url/services/method/' );
//soapEnv:Envelope is the main object.
def element=rootNode.'soapenv:Body'.'ns1:anaDeger'.'ns1:altDeger';
if(element == ''){
//Deletes the node if the field has no value
rootNode.'soapenv:Body'.'ns1:anaDeger'.'ns1:altDeger'.replaceNode { }
}
else if (element.text().size() == 1){
//Adds two leading zeros if the length of the value in the field is 1
rootNode.'soapenv:Body'.'ns1:anaDeger'.'ns1:altDeger'.replaceBody('00'+element.text());
}
responseBodyTextToClient = XmlUtil.serialize(rootNode);
GROOVY