web service cannot cast object saxsource class domsource

I have a webservice to generate an id .
The script which i use to generate the token is as below

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

Element root = ((DOMSource) sourceResponse).getNode().getFirstChild();
NodeList result = root.getElementsByTagName(“token”);
String xmlContent = result.item(0).getTextContent();
String out = xmlContent

But i get the following error when i run the process.

Caused by: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: Groovy script throws an exception of type class org.codehaus.groovy.runtime.typehandling.GroovyCastException with message = Cannot cast object ‘javax.xml.transform.sax.SAXSource@1071c6b’ with class ‘javax.xml.transform.sax.SAXSource’ to class ‘javax.xml.transform.dom.DOMSource’.

Can anyone help?
Im using Bonita 7.1

Regards,
A.

Hi,

Are you using the web service connector? Is that happening when you’re trying to parse the response?

Thanks

Hi,

Yes i am using a webservice connector . Yes happens when im trying to parse the repsonse.
The same script worked in version 5.10

Thanks.