I am using Soap UI 5.7.0, i’m new in scripting. below script is failing with error ‘ERROR:An error occurred [Failed to dispatch using script; org.apache.xmlbeans.XmlException: error: Content is not allowed in prolog.], see error log for details’ What to do to resolve it.
import groovy.xml.*
import groovy.sql.Sql
import groovy.lang.Binding;
import groovy.lang.Script;
def requestBody="";
try {
while ((line = mockRequest.getrequestContent().getReader().readLine()) != null)
{
requestBody = requestBody+line;
}
} catch (Exception e) {
log.info(e)
}
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(mockRequest.requestContext);
def holder = groovyUtils.getXmlHolder(requestBody);
def CCNumReq = holder.getNodeValue("//cardNumber");
requestContext.ccnum = CCNumReq
Expecting return value as one of the tag value from request xml.
user24905944 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.