XML file header: <?xml version='1.0' encoding='utf-8'?>
XSD file header: <?xml version='1.0' encoding='utf-8'?>
hello<?xml version='1.0' encoding='utf-16'?>
I zipped the xml in a Mac OS and sent it to a Windows machine, the default compression changes these files so the encoding sent this message.
Happened to me with @JsmListener
with Spring Boot when listening to IBM MQ. My method received String
parameter and got this exception when I tried to deserialize it using JAXB.
It seemed that that the string I got was a result of byte[].toString()
. It was a list of comma separated numbers.
I solved it by changing the parameter type to byte[]
and then created a String
from it:
@JmsListener(destination = "Q1")public void receiveQ1Message(byte[] msgBytes) {var msg = new String(msgBytes);
I had encountered this message when running a test case in SoapUI:
org.xml.sax.SAXParseException; systemId: file://; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
After quite some time I figured out the reason being the following line:
def holder = groovyUtils.getXmlHolder("SoapCall#Request") // Get Request body
And the reason was that the test step was actually named "SOAPCall" and not "SoapCall". I suppose the returned string was empty, which caused the "prolog" error.