You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Shahi, Ashutosh" <As...@ca.com> on 2004/09/20 16:32:32 UTC

Help on attachments!!

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