从soapUI的返回xml中获取json数据

从soapUI的返回xml中获取json数据_第1张图片

方法(1)

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )

def response = context.expand( '${0006_001_006#Response}' )

def holder = groovyUtils.getXmlHolder(response )

def tradeDetails = holder.getNodeValue("//ebill[1]/tradeDetails[1]")

import groovy.json.JsonSlurper

def slurper = new JsonSlurper()

def re = slurper.parseText(tradeDetails)

def result=re.tradeNo

方法(2)

import groovy.json.JsonSlurper

def tradeDetails = context.expand( '${0006_001_006#Response#//ebill[1]/tradeDetails[1]}' )

def slurper = new JsonSlurper()

def re = slurper.parseText(tradeDetails)

def result=re.tradeNo

你可能感兴趣的:(从soapUI的返回xml中获取json数据)