Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
In my previous blog Read Multiple attachment content inside adapter module (Read Multiple attachment content inside adapter module) we saw about creating an adapter module which reads the attachments. Now in PI 7.1 we have an option to read the input attachments from the source message and create new output attachments or remove the attachment in Message Mapping itself. In this blog I would like to give you some information about the interfaces and methods present in PI 7.1 mapping API which helps to read the multiple attachments from the input source message. The interface “*Inputattachments*” in PI 7.1 mapping API contains methods to read the attachments of the XI message in the mapping. *Methods in inputattachments interface:*    1. areAttachmentsAvailable()      This method checks for the availability of attachments in the input message, it returns true, if the attachments can be accessed in the message mapping.      This depends on the settings of the operation mapping. Operation mapping in the Enterprise Service Repository has a flag to express whether the mapping wants to read the input attachments.    2. getAllContentIds()      The method getAllContentIds gets the content IDs of all input attachments of the source message. It is also possible to get the content IDs of the attachments, if the attachments themselves aren't available for accessing.      It returns Collection of Strings with all content IDs of the attachments.    3. getAttachment()     getAttachment method takes the contentId as input parameter and returns the attachment content with the given contentId, provided there exists an attachment with this contentId.     It returns null if there is no such attachment. To get the attachment content we will be using the “*Attachment*” interface methods getContent(),getContentId(), getContentType () and getBase64EncodedContent(). These methods will return the attachment data provided that the “*Read Attachments*” flag has been checked in the operation mapping. Otherwise, this method will return null. *Creating an UDF to read the multiple attachments in message mapping:*While creating the Operation mapping make sure that you check the option ”*Read Attachments*”. Test the UDF code during runtime.

5 Comments