SAAJ - adding an attachment to a reply in the servlet getting exception on client
posted 3 years ago
I'm fairly new to saaj and web services, any help appreciated.
I'm working on sending a binary file through a web service. My client can send the file just fine but when the servlet tries to add an attachment to the response it blows up. I get a SAAJ exception about the content type:
ERROR: 'Content is not allowed in prolog.'
24-Oct-2012 13:59:28 com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory createEnvelope
SEVERE: SAAJ0511: Unable to create envelope from given source
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
I think its to do with the headers on the response but not sure how to set these. Do these have to be set differently from when you are adding the attachment on a request? Any examples of a servlet that adds soap attachments would be very handy please.