I have below web service request. I am trying to update a property using groovy script.
Webservice:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.webserviceX.NET/">
<soap:Header/>
<soap:Body>
<web:ChangeLengthUnit>
<web:LengthValue>${=(int)(Math.random()*9999)}</web:LengthValue>
<web:fromLengthUnit>Inches</web:fromLengthUnit>
<web:toLengthUnit>Centimeters</web:toLengthUnit>
</web:ChangeLengthUnit>
</soap:Body>
</soap:Envelope>
Groovy script:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
// get XmlHolder for request message def
holder = groovyUtils.getXmlHolder( "ChangeLengthUnit#RawRequest" )
// change password using XPath
holder["//*:LengthValue"] = "1234"
// write updated request back to teststep
holder.updateProperty()
context.requestContent = holder.xml
I am unable to update Lengthvalue tag using above script. I an getting below error
org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA error at line: 4