Obtaining data from a custom widget

Hi, in my main form i have an variable name "isValid" ($data.isValid) and i need to take the value from a Custom Widget, the widget is this:

Webservice connector output response

I have a webservice connector which creates an id everytime a particular task is performed.
I have the following as the groovy script output.

import javax.xml.transform.*
import javax.xml.transform.dom.*
import org.w3c.dom.*
import groovy.xml.DOMBuilder

Element root = ((DOMSource) response).getNode().getFirstChild(); // warning
NodeList result = root.getElementsByTagName("variable");
String xmlContent = result.item(0).getTextContent();

out = xmlContent // warning