Chinmoy,

Can you also attach a sample message that you try to read with this code?

Andreas

On Thu, Dec 18, 2008 at 06:23, Chinmoy Chakraborty <[email protected]> wrote:
> Andreas,
>
> Here is my code snippet.
>
> String contentType = multipart/related;
>  boundary=MIMEBoundaryurn_uuid_D988AB74BC9802BDC21229577126047;
>  type="text/xml";
>  start="<0.urn:uuid:[email protected]>"
>
> MimeHeaders mimeHeaders = new MimeHeaders();
> mimeHeaders.addHeader("Content-Type", contentType);
> // Create the SOAP Message using mimeHeader and inputStream
> MessageFactory mf = MessageFactory.newInstance();
> SOAPMessage soapMsg = mf.createMessage(mimeHeaders, in);
>
> The inputstream is a SOAPMessage with attachments. Now the newly created
> soapMsg in above code snippet does not contain any attachment parts.
>
> I am trying to get attachment parts in the following code snippet:
>
> List attachments = new ArrayList()
> if (soapMsg.countAttachments() > 0) {
>         Iterator itr = soapMsg.getAttachments();
>         while (itr.hasNext()) {
>           AttachmentPart att = (AttachmentPart) itr.next();
>           DataHandler dh = att.getDataHandler();
>           attachments.add(dh);
>         }
>       }
>
> The attachment list is always empty. I am using following jars:
>
> axiom-api-SNAPSHOT.jar (modified on 16th Dec, 2008)
> axiom-dom-SNAPSHOT.jar (modified on 16th Dec, 2008)
> axiom-impl-SNAPSHOT.jar (modified on 16th Dec, 2008)
> axis2-saaj-SNAPSHOT.jar (modified on 12th Dec, 2008)
> axis2-saaj-api-1.4.jar (modified on 4th April, 2008)
>
> Chinmoy
>
>
>
> On Thu, Dec 18, 2008 at 6:49 AM, Andreas Veithen <[email protected]>
> wrote:
>>
>> Chinmoy,
>>
>> Can you post the code that demonstrates the problem?
>>
>> Andreas
>>
>> On Wed, Dec 17, 2008 at 13:40, Chinmoy Chakraborty <[email protected]>
>> wrote:
>> > Hi All,
>> >
>> > I am creating SOAPMessage from inputstream. The inputstream is SOAP with
>> > attachments. But the attachmentParts becomes zero in the newly created
>> > SOAPMessage though the content type is "multipart/related".
>> >
>> > Why it is not created attachments when I am creating SOAP from
>> > inputstream
>> > (with attachments)? I am using axiom-api-SNAPSHOT.jar,
>> > axiom-dom-SNAPSHOT.jar, axiom-impl-SNAPSHOT.jar.(Axis2 1.4.1)
>> >
>> > Chinmoy
>
>

Reply via email to