There seems to be no 'message log' for REST like there is for SOAP - I don't know why that is.
Regarding this workaround, all it does is to put the message body into your script log.
It's only the message body, so that could easily be 'null' for things like GET requests, which usually don't have any message body. If you need to see more, such as the headers, you can log those too:
log.info "--Headers--"
mockRequest.requestHeaders.each {log.info it}
log.info "--Body--"
log.info mockRequest.requestContent
You should also be aware that there is an issue with other request types, like PUT and DELETE, where for some reason the request body is not available by the above method, and you will always get null. If I recall from when I looked into it, this was a bug with the Jetty webserver, not in the SoapUI code... but there is a workaround for this... (my version is based on kjdivya's post here: https://community.smartbear.com/t5/SoapUI-Pro/Mock-Service-mockRequest-requestContent-is-NULL-HTTP-PUT/td-p/42138):
import com.eviware.soapui.impl.rest.RestRequestInterface.HttpMethod
void fixIfPutOrDelete ( mockRequest ) {
if ((mockRequest.method == HttpMethod.PUT) || (mockRequest.method == HttpMethod.DELETE)) {
InputStream is = mockRequest.request.inputStream
BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
StringBuilder sb = new StringBuilder()
while ((s=br.readLine()) != null) {
sb.append(s)
}
mockRequest.requestContent = sb.toString()
}
}
See the attached screenshot for how I put the two together to see the incoming requests.