Forum Discussion
15 years ago
thanks for the head start (am also a newbie, having just installed it today)
thot i share the code i did, so that someone may find it useful
thot i share the code i did, so that someone may find it useful
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def holder = groovyUtils.getXmlHolder(mockRequest.requestContent)
//get the request header
def ncdRequestType = String.valueOf(holder.getNodeValue("//etiq:soaHeader/ncdRequestType"))
def RqUID = String.valueOf(holder.getNodeValue("//etiq:soaHeader/RqUID"))
//get the request parameters
def curVehNo = String.valueOf(holder.getNodeValue("//etiq:NCDRequest/ncdReqSOABO/curVehNo"))
def idNo1 = String.valueOf(holder.getNodeValue("//etiq:NCDRequest/ncdReqSOABO/idNo1"))
//set the response header
//in the response, change the parameter from ? to $(txtResponse)
context.setProperty("txtRqUID", RqUID)
context.setProperty("txtNcdRequestType", ncdRequestType)
//set the default response values
//in the response, change the parameter from ? to $(txtResponse)
context.setProperty("txtResult",0)
context.setProperty("txterrorCode",0)
context.setProperty("txterrorMessage",'Record not found')
//list the text cases
//in the response, change the parameter from ? to $(txtResponse)
if(ncdRequestType == "FetchNCD"){
if (curVehNo == "WPM4688" && idNo1 == "661013055464"){
context.setProperty("txterrorCode",1)
context.setProperty("txterrorMessage",'Success')
context.setProperty("txtResult",55)
}
if (curVehNo == "NAA59" && idNo1 == "661013055464"){
context.setProperty("txterrorCode",1)
context.setProperty("txterrorMessage",'Success')
context.setProperty("txtResult",40)
}
}