Forum Discussion

dseel's avatar
dseel
Contributor
15 years ago

POST with no body causes 'Unexpected end of file after null'

Hi:

I'm using SOAPUI Pro 3.5.1 to run a REST mock service using a groovy script in the OnRequest tab. When I send a normal POST request to the mock service, everything works fine. However, if I send a POST that has no content at all (application/x-www-form-urlencoded, or any other content type) the mock service returns this error:

HTTP/1.1 500 Internal Server Error\r\n
Content-Type: text/html; charset=iso-8859-1\r\n
Transfer-Encoding: chunked\r\n
Server: Jetty(6.1.x)\r\n
\r\n
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">\r\n
<soapenv:Body>\r\n
<soapenv:Fault>\r\n
<faultcode>Server</faultcode>\r\n
<faultstring>org.apache.xmlbeans.XmlException: error: Unexpected end of file after null</faultstring>\r\n
</soapenv:Fault>\r\n
</soapenv:Body>\r\n
</soapenv:Envelope>

Even if I comment out everything in the OnRequest tab of the Mock Service, I still get this error. I do *not* have 'Enable Mock HTTP Log' enabled in preferences, as I noticed on the forums that this could cause this error as well.

Please let me know if there is a workaround or if it can be fixed.

Thanks,
Dave

15 Replies

  • No, this is not what I was expected.

    I have valid cases where a POST or PUT request is made that has *no* body at all (content length is zero). The content type might be application/x-www-form-urlencoded or it might be something else. But either way, I want the Mock service to accept a POST/PUT request that has no content and not reply with any error. Instead, the MockService should get into the OnRequest script and handle things normally, except the request content (mockRequest.getRequestContent()) would be null.

    Thanks,
    Dave
  • It is very strange.... I tried it again and now everything looks fine. I don't believe I changed anything. I'll have to keep an eye on it. Thanks for the fix.

    Cheers,
    Dave
  • eraghunair's avatar
    eraghunair
    New Contributor
    I had the same problem. Every alternate request failing!!!

    I had 3 mocks running. Tried changing the ports of all the mocks to very different ones...didn't work.

    When I disabled "Enable Mock HTTP Logs" amazingly the error went off.


    Is there any side effect of disabling this setting?