This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
The only time I have seen that message, there really was something odd about the first line of the document.
Joined: Aug 20, 2012
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?