File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes SAAJ - adding an attachment to a reply in the servlet getting exception on client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "SAAJ - adding an attachment to a reply in the servlet getting exception on client" Watch "SAAJ - adding an attachment to a reply in the servlet getting exception on client" New topic
Author

SAAJ - adding an attachment to a reply in the servlet getting exception on client

dan pudwell
Greenhorn

Joined: Oct 24, 2012
Posts: 1
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.

here is my client code:

and here is my server code:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SAAJ - adding an attachment to a reply in the servlet getting exception on client