I want to change the node “firstname” in my XML. I wrote a groovy script for it, but it doesn’t do anything. When I log the line, were I set firstname.value, I get the right result. But somehow it doesn’t save the changes.
This is my Code:
def Message FirstName2Fullname(Message message) {
def fullName = message.getProperty("ContactName")
Reader reader = message.getBody(Reader)
def body = new XmlParser().parse(reader)
body.properties.firstname.value[0] = fullName
String modifiedXmlString = XmlUtil.serialize(body)
message.setBody(modifiedXmlString)
return message
}
Please help
I tried Groovy IDE, searched the internet but no success.
New contributor
Ericson2805 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.