Forum Discussion

bhelm's avatar
bhelm
New Contributor
15 years ago

Failed to find Mock Response from SoapUI 3.6.1 w/QUERY_MATCH

I had a mock operation with only one response and dispatch type Sequence. I added some error mock responses to the mock operation and corresponding queries for each, with the default response being the original only response. Now none of the responses are being returned; instead, I get the fault below. Can anybody give me a clue what I have messed up?

javax.xml.ws.soap.SOAPFaultException: Response was of unexpected text/html ContentType. Incoming portion of HTML stream: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>Server</faultcode>
<faultstring>Failed to find MockResponse</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>Server</faultcode>
<faultstring/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

Another clue: soap-errors.log shows this NullPointerException:
2011-01-28 17:18:22,100 ERROR [errorlog] java.lang.NullPointerException
java.lang.NullPointerException
at com.eviware.soapui.tools.SoapUIMockServiceRunner$LogListener.onMockResult(SoapUIMockServiceRunner.java:230)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:405)
...

What could I have made null that should not be?

One further question, why is the content type text/html for XML output? I expect SoapUI to ALWAYS output text/xml.

3 Replies

  • bhelm's avatar
    bhelm
    New Contributor
    Looking at the project XML, it appears the problem was that the QUERY_MATCH default response in the XML did not match what was displayed in the editor. I chose a valid response in the editor, but the XML had "Response 1", which was not the name of any response. Manually editing the XML seems to have fixed the problem for now, although I don't know how the XML got the wrong value.
  • Thank you! I had this exact same problem, and yes this same bug still occurs for me in v4.5.1. I had renamed a response inside soapUI but the XML had not been updated, even after saving it, and restarting. I had to go into the XML and search for 'Response 1' and there it was, even though 'Response 1' had been renamed inside soapUI ages ago.

    I'm running on mac if that makes any difference.
  • maxfactor's avatar
    maxfactor
    Occasional Contributor
    I had a very very similar problem and this posted solution fixed it.

    I had just one simple mock response with no query match at all. I started the Mock response engine and then generated the request and received "Failed to find MockResponse" error from SoapUI. So I looked in my project file and I found:
    <con:defaultResponse>Response 1</con:defaultResponse><con:response name="MockResponse 2"

    MY Mock response is really named "MockResponse 2" and I have no idea where the default name "Response 1" came from but I changed the default to also be "MockResponse 2", re-ran the test and then the Mock response was generated.

    Thanks Bhlem!

    I am using SoapUI 2.5.2 Pro on a Windows 7 machine.

    This seems like a bug that has been around since the original post in 2011.