KarelHusa
6 years agoChampion Level 1
Logging a mock service response
Dear colleagues,
I would like to log requests and responses from within the SoapUI mock service in order to see what has been sent to the mock service and what the mock service responded.
I have created a script and put it into "AfterRequest Script" of the mock service.
I am logging the request by:
mockResult.getMockRequest().getRequestContent()
and response by:
mockResult.getMockResponse().getResponseContent()
However, the content of the response is only the response template, before parameter expansion, i.e. contains <id>${=java.util.UUID.randomUUID()}</id> etc.
How can I log the exact response which has been sent out to the service consumer? I went through the SoapUI 5.4.1 API, but was not able to find the way.
Hey, simply use:
log.info mockResult.getResponseContent()
Check https://www.soapui.org/apidocs/com/eviware/soapui/impl/rest/mock/RestMockResult.html