Forum Discussion

Toby_Hage's avatar
Toby_Hage
Occasional Contributor
16 years ago

log response message in listener

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

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

4 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    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
  • Toby_Hage's avatar
    Toby_Hage
    Occasional Contributor
    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.
  • omatzura's avatar
    omatzura
    Super Contributor
    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