CAMOBAP
CAMOBAP

Reputation: 5657

SoapUI : Mock service that not returning response

Is there possible create SoapUI Mock service that not return response but it is just closing connection?

Upvotes: 2

Views: 3893

Answers (1)

Marcellus
Marcellus

Reputation: 1287

I'm quite sure what you're asking for is not possible with SoapUI MockServices. There are some extensive possibilities involving scripting, and it is even possible to access the underlying javax.servlet.http.HttpServletRequest and Response objects. Have a look here for details:

http://www.soapui.org/Service-Mocking/creating-dynamic-mockservices.html

Using scripting, it is possible to write a mock service request handler like this in SoapUI that just resets and closes the output stream:

mockRequest.getHttpResponse().reset();
mockRequest.getHttpResponse().getOutputStream().close();

But the client will still see a HTTP response header like this generated by the servlet container:

HTTP/1.1 200 OK
Content-Length: 0
Server: Jetty(6.1.x)

It is generally not possible to abort the connection immediately from inside a servlet (which is what SoapUI mock services are built upon). Have a look here about this topic:

How to close a HTTP connection from the HttpServlet

I'd use something completely different than SoapUI, most likely a scripting technology like PHP or Perl to achieve what you're asking for.

Upvotes: 2

Related Questions