ws-soap-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Yang <Andrew.X.Y...@Sun.COM>
Subject How to get SOAP Envelope from SOAP with Attachment Message (MIME Type)??
Date Fri, 23 Aug 2002 18:31:56 GMT
I have used following code to get SOAP Envelope from HTTPServlet Request:

if(request.getContentLength() > 0)
      BufferedReader reader = req.getReader();

      javax.xml.parsers.DocumentBuilder xdb =
      org.w3c.dom.Document doc = xdb.parse(new
      org.apache.soap.Envelope env = org.apache.soap.Envelope.unmarshall(
      ... ...
   ... ...

.. ... // process the Envelope env

Now I need to process "SOAP With Attachment" message transmitted via HTTP. The message was
sent as

org.apache.soap.messaging.Message msg = new
if( attachmentFlag ) 
   ... ... // get attachment, assume it is a text file.

   MimeBodyPart mbpAttach = new MimeBodyPart();
   mbpAttach.setHeader("Content-ID", "the-attachment");

msg.send(new, URI, envelope);

If the attachmentFlag is off, I got the Envelope and the program runs fine.

However, if the attachmentFlag is on, the client does indeed sent the MIMI message over HTTP,
but the server-side program does not get correct Envelope. The error message is:
SwaHttpReceiveServlet: Exception: 
   org.xml.sax.SAXParseException: Document root element is missing.

I guess I have to somehow disassemble the MIME Message, seperate the SOAP part and the attachment

Has anyone had similar problem? How did you solve it? What are possible solutions?

Thanks you in advance!


View raw message