Forum Discussion
mcbootus
14 years agoContributor
Problem solved - code provided by SOAP UI team!
import javax.xml.xpath.*
import javax.xml.parsers.DocumentBuilderFactory
def xpath = XPathFactory.newInstance().newXPath()
String xml = mockRequest.getRequestContent()
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder(xml)
def dt = holder['//ns1:REQUEST MADE/ns1:TO YOUR/ns1:MOCKSERVICE']
context.mockService.project.setPropertyValue("XML ELEMENT YOU WISH TO GRAB", dt)
log.info dt
and put it in MockService onRequestScript tab.