5

I am mocking my web service using soapUI. Now, I also want to test fault. For this, the mock service (=soapUI) should return a HTTP 500. Does anyone know, how soapUI can do this?

thanks

Markus
  • 151
  • 1
  • 4

3 Answers3

7

This can be achieved with the following Groovy code:

mockRequest.getHttpResponse().sendError(500)
Markus
  • 151
  • 1
  • 4
4
  • Create a mock service.
  • Create a new mock response.
  • Open the mock response editor (by double clicking it) and click on the exclamation mark symbol which creates a SOAP Fault response.

If you look at the RAW code of the answer, you see a 500 error code. (HTTP/1.1 500 Internal Server Error)

Btw if you have created two reponses, a successful and a fault response, then when using the mock service service, SOAPUI alternates between the two responses.

Dirk
  • 61
  • 5
4

Right Click on the MockResponse > Show MockResponse Editor Enter. Look at MockResponse Properties on the left hand side, bottom Scroll down to search for "Response HTTP-Status" edit the value to 500.