I am trying to build a test automation script using groovy. My input template is like myXML variable
I am reading input data from excel file and replacing the values and firing the request through SOAPUI.
my code is like this
def myXML ='''<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="xyz.org/common" xmlns:fin="xyz.org/finance">
<fin:myBalance>
<com:loginName>test</com:loginName>
<fin:params>
<fin:name value="username"/>
<fin:Id value="12345"/>
<fin:nickname value="usr1"/>
</fin:params>
</fin:myBalance>
</soapenv:Body> '''
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def reqHolder = groovyUtils.getXmlHolder("InputReq#Request")
reqHolder.namespaces['soapenv']= 'http://schemas.xmlsoap.org/soap/envelope/';
reqHolder.namespaces['com']= 'xyz.org/common';
reqHolder.namespaces['fin']= 'xyz.org/common';
reqHolder.setNodeValue("//fin:myBalance[1]/${newTag.getContents()}[1]",
"${newValue.getContents()}");
If I want to change node value this works perfectly. But I am not able to find a way to change an attribute using reqHolder. Say I want to change fin:Id value="12345" to "6789"
Is there a way to change ?