cancel
Showing results for 
Search instead for 
Did you mean: 

PI7.3 Mail Adapter - Unzip XLSX and payload swap

former_member183909
Active Participant
0 Kudos

Hi

I am using PI7.3 and want to use Mail adapter to read an email with an XLSX attachment.  As you may know the MS Excel 2010 XLSX is a zipped, XML-based file format developed by Microsoft for spreadsheets.  So it looks and opens like a spreadsheet within Office. But it can be unzipped so get to the XML version of the spreadsheet.

Apparently I can adapter modules to UNZIP the XSLS and then swap the payload to send the XML part.

I have been following Michal Krawczyk blog on this but perhaps not for my version of PI7.3.

My processing logs state that the XLSX has been unzipped but it is unable to find the worksheet (Swap: no matching payload found).  (the worksheet is there in that folder when I unzip it on my desktop).   So I suspect the swap.keyValue is not correct.  So how can this be determined ?  

My configration of the adapter is

Module nameTypeModule key
AF_Modules/PayloadZipBeanLocal Enterprise Beanunzip
AF_Modules/PayloadSwapBeanLocal Enterprise BeanPayloadSwapBean
sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBeanLocal Enterprise Beanmail

Module keyNameValue
PayloadSwapBeanswap.keyNamecontent-type
PayloadSwapBeanswap.keyValueapplication/xml;name="xl/worksheets/sheet1.xml"
unzipzip.modeunzip

Accepted Solutions (1)

Accepted Solutions (1)

former_member183909
Active Participant
0 Kudos

Think that Michal Krawczyk blog is perhaps a little unclear for me...or I just assumed he was dealing with an attachment...or my version of PI7.3 

But I have now added a new first stepSo firstly get the email attachment.   Then unzip and then get the result of the unzip ..the sheet1.xml.

Module nameTypeModule key
AF_Modules/PayloadSwapBeanLocal Enterprise BeanGetAttachment
AF_Modules/PayloadZipBeanLocal Enterprise Beanunzip
AF_Modules/PayloadSwapBeanLocal Enterprise BeanPayloadSwapBean
sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBeanLocal Enterprise BeanMail

Module keyNameValue
GetAttachmentswap.keyNamePayload-Name
GetAttachmentswap.keyValueMailAttachment-1
PayloadSwapBeanswap.keyNamecontent-type
PayloadSwapBeanswap.keyValueapplication/xml;name="xl/worksheets/sheet1.xml"
unzipzip.modeunzip

I did not notice until now ...but my problem now is the way that EXCEL seems to hold all the spreadsheet data some appears in sheet1.xml and some in another sharedStrings.xml.  (That seems daft - but who am I to question microsoft !).  

But why would that be ?  I guess I'll figure it out.

Answers (0)