Hi all,

Some help needed on attachments.

 I have an input stream which has a soap message along with attachments i.e., basically a MIME message.

 How do i read this input stream into a Message (or SOAPMessage). I have seen many examples,
where the attachments were created later on, once we formed the
SOAPPart, but could not find anything where the input stream itself
has attachments.
        Right now am coding something like:

MessageFactory msgFactory = MessageFactory.newInstance();
MimeHeaders mimeHeaders = new MimeHeaders();
mimeHeaders.addHeader("Content-Type","text/xml");
message = (Message)msgFactory.createMessage(mimeHeaders,io);

//message.writeTo(System.out);
SOAPPart soapPart = message.getSOAPPart();
envelope = soapPart.getEnvelope();

and am getting an exception saying "Document Root Element is missing"
meaning it is just expecting a soap document and not a MIME message as
inputstream.

 

Any suggestions?

 

Regards,

Ashutosh Shahi

 

Reply via email to