It's not a secret anymore!
The moose likes Web Services and the fly likes content not allowed in prolog exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "content not allowed in prolog exception" Watch "content not allowed in prolog exception" New topic

content not allowed in prolog exception

James Hammer

Joined: Mar 15, 2009
Posts: 1

I am trying to send xml to a java-based web service given to me by a thrid party via a c#.NET application, and I get the "org.xml.sax.SAXParseException: Content is not allowed in prolog" error.

I have verified the xml against the schema, and I passed the memorystream I am using to hold the xml to an .xml file, then opened the file with a hex editor to make sure that there were no undesired characters in the prolog, and there are none. When opened, the first characters in the file are

<?xml version="1.0" encoding="utf-8"?>

The class I was given to use to send the xml data to the web service accepts a byte array. I figure that creating the xml using an XmlTextWriter to a utf-8 encoded memorystream, then sending the contents of the stream to a byte array is the most direct method.

I have done a lot of research and tried all the possbilities around this issue that I could find, but nothing works. Could someone please help? Thanks in advance.

By the way, here is a portion of what the web service returns to me. In the payload of the SOAP message, should the data after the <submissionData> element look like that, or be readable xml like the content before it?


Payload: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http:/
/" xmlns:xsi="
-instance" xmlns:xsd=""><soap:Body><postSubmissi
on xmlns=""><submissionHeader><agcHcsId>1</agcHcsId><
Amit Ghorpade

Joined: Jun 06, 2007
Posts: 2846

"Jack Hammer " welcome to Javaranch
please check your private messages for an important administrative matter. You can check them by clicking the My Private Messages link above.

|Asking Good Questions|
I agree. Here's the link:
subject: content not allowed in prolog exception
jQuery in Action, 3rd edition