aspose file tools*
The moose likes Web Services and the fly likes Content is not allowed in prolog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Content is not allowed in prolog" Watch "Content is not allowed in prolog" New topic
Author

Content is not allowed in prolog

Mike Whelihan
Greenhorn

Joined: Aug 20, 2012
Posts: 2
Hello All,

I have been a long time reader at this forum, but this is my first time posting. I am attempting to write some java code for making a SOAP web services call with an attachment. I think I am pretty close to getting it to work, but the server is throwing an error on my request: "SystemId Unknown; Line #1; Column #1; Content is not allowed in prolog." I am getting a response, but it is a generic failure message.

Here is my code:



I looked at the two files, test-ccd-1 and new-xds-metadata-template with a hex editor and there are no weird characters at the beginning of the file. If I copy and paste the text from new-xds-metadata-template into a SoapUI request and attach the test-ccd-1 file it works fine (as long as I set Type to "XOP" and enable MTOM). I'm thinking that it might have something to do with the way I'm creating the prepMsg and prepAttachment StreamSource variables. Any ideas on what the problem could be? I've been searching the web for a few days without much luck.

Thanks!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12835
    
    5
The only time I have seen that message, there really was something odd about the first line of the document.

Bill
Mike Whelihan
Greenhorn

Joined: Aug 20, 2012
Posts: 2
After scouring through some logs, I think it may be an encoding issue. I noticed that when I send the request through SoapUI the "Content-Transfer-Encoding" is set to "8bit" and when I'm sending it through my java app it is listed as "binary". I tried added this line of code but it doesn't seem to change anything:



I am also trying to set the attachment part mime header to match SoapUI:



neither of these calls seem to work. Any thoughts/ideas?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Content is not allowed in prolog