|
Title: log response message in listener Post by: Toby Hage on July 25, 2008, 12:06:11 pm Hello,
Have searched the forum and read the manual but couldn't find this. i'am trying to log the response from a webservice in a listener, but don't know which object to use. I have the following Code: public synchronized void afterTestStep(LoadTestRunner runner,LoadTestRunContext context, TestRunner testRunner,TestRunContext testContext, TestStepResult result) { def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def holder = groovyUtils.getXmlHolder(xxx.responseContent ) def faulstring = holder["string(//faultstring)"] writer.writeLine(faulstring) } which object to use on the pace of the xxx??? thanx in advance Title: Re: log response message in listener Post by: omatzura on July 25, 2008, 03:56:48 pm Hi Toby,
try implementing the SubmitListener interface instead, and implement the afterSubmit method to get the response from the available Submit object.. makes sense? regards! /Ole eviware.com Title: Re: log response message in listener Post by: Toby Hage on July 25, 2008, 04:40:07 pm Hi Ole,
That makes sense. But I think not in this situation. I'll think :-) Because I want to log also things from the afterTestStep method and want everything in one file and one line. Is is possible to retrieve response from the afterTestStep method? regards, Toby. Title: Re: log response message in listener Post by: omatzura on July 25, 2008, 10:30:30 pm Hi,
ah, sure.. what you can do is cast the TestStepResult to a WsdlTestRequestStepResult, which has a getResponseContent method, so in your code you should be able to replace "xxx" with "result".. !? regards, /Ole eviware.com Title: Re: log response message in listener Post by: Toby Hage on July 26, 2008, 10:40:57 am Works perfect!
Thank you. |