Ask a Question

(RequestFilter.afterRequest) triggered when (SOAP Request) is sent but not when Project Test is Run?

Occasional Contributor

(RequestFilter.afterRequest) triggered when (SOAP Request) is sent but not when Project Test is Run?

Hi there,

I am very new to SoapUI and I may be missing something very obvious so please go easy on me!


I have set up a project with a Test Case that contains a Soap Request.

I am using an event handler to remove some "CDATA" code, so that the resulting formatted xml will be easier to extract values from.

The event handler triggers fine when I run the request in the request editor (click the "Send" button), i.e. the properly formatted XML is displayed in the response field.
But, if I click the "Run" button, all the test steps are executed but the event handler does not trigger and it does not remove the problematic "CDATA" text.

I have some property transfers that are set up to extract the data when the properly formatted XML response is returned, but these are not found when all the test steps are Run.


Here is my code for the Event Handler:


// Get the response content
if( request.response == null )

def content = context.response

// Replace the string

content = content.replaceAll( "<!", "")
content = content.replaceAll( "\\[CDATA\\[", "" )
content = content.replaceAll( "<\\?xml version=\"1.0\" \\?>", "" )
content = content.replaceAll( "]]>", "" )

// Write the new content to the response
context.httpResponse.responseContent = content


Any help on this would be greatly appreciated.


Champion Level 3

Hmm.. little strange.

Probably, you want to quickly try
TestRunListener.afterStep orSubmitListener.afterSubmit

Hope you might aware of documentation

Occasional Contributor

Thanks for your help, 

I transferred the Groovy code to the TestRunListener.afterStep and it works now when running the full test. 



Showing results for 
Search instead for 
Did you mean: