Skip to Content
avatar image
Former Member

Receiving null when accessing the content of an attachment

Hello Iu2019ve got a mail to soap scenario. I try to get the attachments of the mail to process them later. That for I am using a java. With the following code I get the attachments:

InputAttachments inputAttachments = transformationInput.getInputAttachments();

After that I get the contentIDs

Collection <String> strContentIds = inputAttachments.getAllContentIds(true);

And loop through them

for (String sContentId : strContentIds) {

u2026.

inputAttachments.getAttachment(sContentId).getContent(); // this is always null

u2026.

}

The problem is that I canu2019t access the content, it is always null. The contentIDs are correct: application/octet-stream;name="hello.xml" and application/octet-stream;name="hello.doc". In this scenario I want to extract the XML and work with it. Can someone tell me why the content is null?

Thanks and Regards,

AleksGj

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 13, 2012 at 09:07 AM

    Hi Aleks,

    Try using the toString function:

    strMailText = inputAttachments.getAttachment(sContentID).getContent().toString();

    Hope this helps,

    Grzegorz

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 13, 2012 at 09:12 AM

    Hello,

    You can try code in this blog, wherein the strContentIds are placed into an Object array and then just looped to get the contents

    Read the attachments of the input XI message in the message mapping

    You can also refer to Note 1255507 - Attachments not being sent to the receiver.

    Hope this helps,

    Mark

    Add comment
    10|10000 characters needed characters exceeded