Forum Discussion

teak's avatar
9 years ago

Property Transfers and CDATA

Hi, I am trying to transfer a responce to a property.      <data contentType="text/plain; charset=UTF-8" contentLength="56"><![CDATA[access_token=674255899342123|OE_p68aK0XgY1rkGYRgkK-c_DIQ]]></da...
  • teak's avatar
    9 years ago

    I managed to get there eventually, 


    I used the groovy script to get the cdata and removed the string "access_token=" from it. I ended up with what I wanted in the end. 


    I'm not sure if this is a good practice though. I thought there maybe and easier way to get it. 


    def groovyUtils = new
    def response = context.expand('${GET access token#ResponseAsXml}')
    def holder = groovyUtils.getXmlHolder(response)
    node_data = holder.getNodeValue("//data")
    context.access_token = node_data.replaceAll("access_token=", ""); context.access_token