SOAPUI/ReadyAPI Notes

Submitted by code_admin on Mon, 07/23/2018 - 14:51

Scripts

Response Level

  1. def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
  2. def holder = groovyUtils.getXmlHolder( mockRequest.requestContent )
  3.  
  4. def username = holder.getNodeValue("/soap:Envelope/soap:Body/ic:requestSOAEndpointsMessage/ic:Credentials/ic:Username")
  5.  
  6. //if ( username ==  "weblogic") return "Response1"
  7. if ( username.equals("weblogic")) return "Response1"
  8.  
  9. return "BadUserNamePassword"

Script Level

Creates a context that can be referred to in response as ${suppliedInput}

  1. def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
  2. def holder = groovyUtils.getXmlHolder( mockRequest.requestContent )
  3.  
  4. def input = holder.getNodeValue("/soap:Envelope/soap:Body/ic:requestSOAEndpointsMessage/ic:Input")
  5.  
  6. context.setProperty("suppliedInput",input )
RJM Article Type
Work Notes