stanjonsson
12 years agoNew Contributor
Problems reading request content
I am trying to write a mock service that does some routing based on the body submitted in a POST request.
When I try doing the following:
mockRequest.requestContent
(which I saw used here: http://www.soapui.org/Service-Mocking/c ... vices.html)
in a dispatch script, the returned content is always null.
I also tried manually reading the request content from mockRequest.getHttpRequest().getInputStream(). That does work the first time around, but if I submit another request shortly afterwards the content read is empty. I tried closing all IO resources but to no avail.
The attached script shows the issue. Start the LoginMock and then run the SuccessLogin request. If it behaves as on my machine the first request should return '"authenticated": true', but subsequent requests return '"authenticated": false' (unless you wait 45+ seconds between requests).
I am running this on Windows 7 in SoapUI 5.0.0.
What is the recommended way to read content from a POST request, in a MockService?
When I try doing the following:
mockRequest.requestContent
(which I saw used here: http://www.soapui.org/Service-Mocking/c ... vices.html)
in a dispatch script, the returned content is always null.
I also tried manually reading the request content from mockRequest.getHttpRequest().getInputStream(). That does work the first time around, but if I submit another request shortly afterwards the content read is empty. I tried closing all IO resources but to no avail.
The attached script shows the issue. Start the LoginMock and then run the SuccessLogin request. If it behaves as on my machine the first request should return '"authenticated": true', but subsequent requests return '"authenticated": false' (unless you wait 45+ seconds between requests).
I am running this on Windows 7 in SoapUI 5.0.0.
What is the recommended way to read content from a POST request, in a MockService?