Forum Discussion

unmesh's avatar
17 years ago

Mocking HTTP responses

Hi,

We want to mock a service which uses XML over HTTP but is not RESTful. It passes XML request with HTTP POST and expect XML response back.
Can this kind of service be mocked with SOAPUi?
I searched through documentation but did not find anything like this.

Thanks,
Unmesh

1 Reply

  • Hello!

    You can do this by writing an OnRequest Script in Groovy. Here you have access to both the request and the response via mockRequest.httpRequest and mockRequest.httpResponse, which return an HttpServletRequest object and a HttpServletResponse object, respectively. For documentation on these classes, please view here and here.

    If the script returns a MockResult object, then further processing will be aborted. You can create such an object using
    def result = new WsdlMockResult(mockRequest)


    Hope this helps!

    Regards,
    Dain
    eviware.com