Forum Discussion
HimanshuTayal
Community Hero
hrn83au :
You can use below script to fetch data from cData tag, there is no need to replace the cData Tag
import com.eviware.soapui.support.GroovyUtils
def response = context.httpResponse.responseContent
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def v=groovyUtils.getXmlHolder(response)
def CDATAXml=v.getNodeValue("//*:return")
//it will print cdata
log.info CDATAXml
def data = new XmlParser().parseText(CDATAXml)
//it will print SONUC value
log.info data.SONUC.text()
Hope it will help you in resolving your issue.
hrn83au
4 years agoOccasional Contributor
I did not understand where to use this script. can you specify that too.
thank you.
- HimanshuTayal4 years agoCommunity Hero
hrn83au :
You can add this in any groovy step or script assertion where ever you want to fetch CDATA value.
- hrn83au4 years agoOccasional Contributor
I shared how I use the script in the screenshots below. I see the script working correctly.
There is a situation like this, as seen in the second picture, I cannot transfer the value of the property transfer to the other webservice.
2.picture
- HimanshuTayal4 years agoCommunity Hero
hrn83au :
Instead of log.info you can use
//getting data from SONUC tag def sonucText = data.SONUC.text() //Setting the value into Properties Test Step context.testCase.getTestStepByName("Properties").setPropertyValue("SOUNC", sonucText.toString())
and you can use that value in you other request
Related Content
- 2 years agoBrianFixzone
- 4 years agocarlomarchesoni
- 5 years agogenki
- 12 months agoTomA
- 5 years agoReshail
Recent Discussions
- 21 hours agoKay