Custom server, ODK Collect - OpenRosa response looks valid but throws exception?

I'm using Collect in conjunction with my own server back-end, which accepts forms and other asset files POSTed from Collect. The server is a PHP script.
I've just downloaded the latest version of Collect from the playstore, and used it to upload a completed form. On a successful POST, my server responds:

<?xml version="1.0" encoding="UTF-8" ?>
<OpenRosaResponse xmlns="" items="1">
<message nature="submit_success">Form submitted successfully</message>

This works fine in old versions of Collect, but the current version throws an exception:

"Error: Generic Exception: Only one root element allowed"

It also logs the upload as failed (even though it was successful) so doesn't remove the form from the queue of forms to be uploaded.
As far as I can see this might be a bug - can anyone shed any light? Is the message complaining about more than one root element in the response, even though there is only one? Or is it referring to more than one root element in something else? I've looked in the Collect code for this error message but I can't find it..
Grateful for any help!

I can get that error message by changing InstanceServerUploaderTaskTest.postResponse() to respond with

"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
"<OpenRosaResponse xmlns=\"\" items=\"1\">\n" +
"<message nature=\"submit_success\">Form submitted successfully</message>\n" +
"</OpenRosaResponse>" +

This does have an additional root element. If I remove that extra root element and match your message, the test passes.

Please debug that test to see the code paths used and then do the same against your server to see where the failure might be happening.

My first thought was that my server was not responding correctly, but testing the server response from a separate HTTP POST indicated a correct response. So I need to check the server response when the POST actually comes from Collect, to see whether this is different.
I'd love to follow your instructions, but I'm afraid that I'm out of my depth - my understanding of Android Studio and of Java is pretty minimal, and I don't really know how to use its test environment. I can't even find the code which does the POST upload, or displays the resulting message. I've tried using the Network Profiler to debug the network traffic, but it doesn't support the HTTP library used in Collect.
The POST upload from Collect used to be done in InstanceUploaderTask, but there now appears to be a number of uploader files (InstanceUploaderActivity, InstanceServerUploaderTask, InstanceUploaderTask and others), and I cannot find the code in any of these files which actually initiates a server connection and POSTs the files! Sorry for being dim, but I really would appreciate if it someone could point me to the right place in the code - as I also have a custom requirement for photo file size reduction, which I need to insert into the uploader code too.
I have the app running on a real device with debugging in the IDE, so I could log diagnostic messages if I could find the code which actually POSTs the files. Any suggestions?