Skip to content

Instantly share code, notes, and snippets.

@hasithaa
Last active February 5, 2018 00:40
Show Gist options
  • Select an option

  • Save hasithaa/6239374 to your computer and use it in GitHub Desktop.

Select an option

Save hasithaa/6239374 to your computer and use it in GitHub Desktop.
import com.eviware.soapui.support.GroovyUtils
import com.eviware.soapui.support.types.StringToObjectMap
import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep
def groovyUtils = new GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( mockRequest.requestContent )
def map = new StringToObjectMap()
holder.declareNamespace("wsa","http://www.w3.org/2005/08/addressing")
holder.declareNamespace("ech","http://www.example.org/EchoService/")
map.put("messageID", holder.getNodeValue("//wsa:MessageID/text()"))
def address = holder.getNodeValue("//wsa:ReplyTo/wsa:Address/text()")
map.put("address", java.net.URLDecoder.decode(address, "UTF-8"))
map.put("echoString", holder.getNodeValue("//ech:echo/in"))
def testsuite = context.mockService.project.getTestSuiteByName("ClientCBServiceSOAP TestSuite")
def testcase = testsuite.getTestCaseByName("echoResult TestCase")
def testrequest = (WsdlTestRequestStep) testcase.getTestStepsOfType(WsdlTestRequestStep.class).get(0)
testrequest.testRequest.setEndpoint(address)
testcase.run(map, false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment