webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Apache poi xssf file Mailing

    Posted Fri April 17, 2015 09:46 AM

    Hi,

    We have excel sheets created in webMethods and stored in linux file structure. In linux the file opens as binary content but in windows OS the same opens perfect as excel workbook.

    My requirement is to now mail this file.
    However when I am trying to pass the workbook object (xssf object) as input to attachment/content in pub.client.smtp , My email receives a corrupted file , ie, it opens with binary content.

    Also, I tried converting xssf Workbook object to byte but its not working for me.

    Could anybody help here ?

    thanks,
    Priya


    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: Apache poi xssf file Mailing

    Posted Fri April 17, 2015 12:00 PM

    Did you set the proper Content-Type in the smtp service so the attachment is valid?

    Try this ContentType = “application/vnd.ms-excel” or application/csv

    HTH,
    RMG


    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: Apache poi xssf file Mailing

    Posted Mon April 20, 2015 06:47 AM

    Hi RMG,

    Thanks for your reply.

    I did try with the following content types:

    application/vnd.ms-excel
    application/csv
    application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml.

    Can u pls suggest what should be the content type? For ex: I am opening the org.apache.poi.xssf.usermodel.XSSFWorkbook and get the workbook object opened. What should be the best way to pass the content ?

    If I try to convert the workbook object to string it just gives : Name: /xl/workbook.xml - Content Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml

    I tried passing the workbook object directly and also after converting to string.

    Thanks,
    Priya


    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Apache poi xssf file Mailing

    Posted Mon April 20, 2015 07:01 AM

    Hi RMG,

    It happened to work out with some more trying…thanks for ur inputs! :slight_smile:

    Following is the config :

    content-type: application/csv
    Encoding: base64.

    I used pub.file.getFile to load the excel file from drive as a stream and it gave the correct attachment in the email.

    Thanks,
    Priya


    #webMethods
    #Integration-Server-and-ESB