Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

dan pudwell
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic