The few posts that talk about this, must be for older versions of Soap UI, or perhaps, maybe Pro. I am on the open source v 5.5.0.
I create a new mock response, I click the exclamation point at the top. That does create a sample fault packet.
So far so good.
But I want to set the HTTP Status to a specific code. Several posts indicate there are options on the left panel for setting http status code, but they are not there. I can't find any way to do it. I tried, in desperation, to just create an http status header, with every possible spelling I could think of for http status, but nothing works.
How would I set a specific http status on this fault?
For example, I need to emulate a 401, 403, 408, 409, 500, 503 and others.
Thanks for answering, but I'm still unclear on exactly how to get the status into the response.
for #1, where do I put it?
for #2, what header? I've tried what I thought it should be, but it did not work, so I must have used the wrong spelling.
I don't have a script, but I found information online that said there is an option in the mock response panel where I can set the status code. I can't find that option, does that option not exist? Is a script the only way to do it?
You mentioned that you created a 'fault' which makes me think you might have a SOAP mockservice?
Status Code is not used in SOAP. It will only be an option for mock responses in a REST service.
Yes, in the mock service, when I create a response, it allows me to create a normal response or a fault response.
My question is, how do I specify which type of fault that is, there are dozens of fault types. According to the documentation, there is supposed to be an option in the fault window to specify which fault type you want. But it's not there. I am current on my install of SOAP UI.
You can only specify the status code for a REST mockservice. See attached. (It should be blue, not green)
So is there no way to mock a speciifc status code for SOAP? I'm interfacing with a vendor that uses SOAP, and I want to set up negative tests to be sure I handle them properly.
SOAP specification doesn't allow for status codes.
When the server returns a SOAP fault:
For SOAP 1.1, the status code must be 500 “Internal Server Error”.
For SOAP 1.2, it varies based on the type of the SOAP fault.
For env:Sender, the status code is 400 “Bad Request”,
but for anything else it is 500 like SOAP 1.1.
Your SOAP version should be automatically detected from your WSDL. You can also change the SOAP version at the Binding level in your project.