Skip to Content
avatar image
Former Member

PayloadZipBean + MessageTransformBean

Hi all,

This is my first post on SCN. I hope to be a positive resource to this community. :-) I wanted to ask a question I have been riddled with for some time. We had the requirement to use a sender file adapter for zipped plain text files (sort of CSV file).

Issues I encountered:

  1. GZip is not really supported by the PayloadZipBean: I assume there is no way around this (Question 1), so we decided to switch to normal Zip files
  2. Using File Content Conversion:
    • Apparently this is not possible, as it tries to convert the inbound zip file into an XML: replaced this by the MessageTransformBean.
    • So at this time, the modules set up are: PayloadZipBean with mode set to unzip, afterwards, the MessageTransformBean with all the parameters set up correctly. This was working fine, as long as the input did not contain any special characters. So on to the next issue.
  3. The plain text files are in codepage ISO-8859-1. I have tried TextCodepageConversionBean with the conversion.charset set to utf-8. I have also tried to use the XMLAnonymizerBean (and changing the charset of the XML to ISO, but no result) before the MessageTransformBean. However, this still results in special characters being replaced by ï?n or question marks. I assume this is because the TextCodepageConversionBean only works on payloads of type plain/text, while the result of the PayloadZipBean is "application/octet-stream". Is there any way to do this properly? (Question 2)
  4. My workaround is quite simple. I use the PayloadZipBean module in a first sender adapter. Drop this file with a file receiver adapter and then use a second file sender adapter with normal FCC with the Encoding set to ISO-8859-1. This works fine - special characters are read correctly. However, I would prefer doing it all in one sender adapter.

If anyone has any answer to my questions or is maybe doing something similar and has questions, please feel free to answer my post! Also thanks to Stefan Grube for his great post working-with-the-payloadzipbean-module-of-the-xi-adapter-framework.

My regards,

Aerv

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    May 23, 2012 at 11:06 AM

    The TextCodepageConversionBean does not work properly, when the ContentType of the source is not known.

    As work around you can set the ContentType with the MessageTransformBean. For this purpose you have to put the MessageTransformbean twice in the module chain.

    The parameters for the first MessageTransformBean would be:

    Transform.ContentType     text/plain;charset=iso-8859-1

    The second appearance of the MessageTransformBean does the conversion, as you have already set.

    Add comment
    10|10000 characters needed characters exceeded

  • May 22, 2012 at 09:42 PM

    Hi,

    1: You are right, gzip is not supported by this bean, so switching to zip was a good decision.

    2: Did you try using the following attribute of MessageTransformBean:

    Transform.ContentType     text/xml;charset=iso-8859-1

    It should help you make PI understand the input as iso-encoded. Special characters should be converted to unicode properly in this case, for further PI processing.

    Regards,

    Greg

    Add comment
    10|10000 characters needed characters exceeded

    • Dear Aerv,

      Just a few more ideas:

      - Did you use Transform.ContentType = iso-8859-1, or the whole value that I mentioned? Most probably it does make a difference.

      - You could try using Transform.ContentType = text/xml;charset=utf-8. I have no idea why whould it work, but it seems worth trying 😊.

      - Are you sure your file is ISO-8859-1 encoded? You can try experimenting with this online tool to confirm that: http://kanjidict.stc.cx/recode.php

      Regards,

      Greg

  • May 22, 2012 at 09:07 PM

    Hi Aerv,

    After reading your post i learned many things, i would prefer 4th point solution to achieve your requirement. Because doing in one scenario may be big risky

    But solution is use OS Command script to zip your file and call OS command in File channel with option beofore message processing then use otehr module(code page conversion).

    Regards,

    Raj

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Raj,

      Thank you for your feedback. I know that using an OS command to unzip (I'm not zipping the file) would also work. But would prefer to do it all in the adapter.

      Regards,

      Aerv

  • May 22, 2012 at 08:44 PM

    while the result of the PayloadZipBean is "application/octet-stream". Is there any way to do this properly? (Question 2)

    Thanks for the elaborate description on this topic.  I see in the help link for the payloadzipbean module as well as Stefan's blog for how to set the content type as text/plain. is that you want?

    http://help.sap.com/saphelp_nw04/helpdata/en/45/da9358a1772e97e10000000a155369/content.htm

    http://scn.sap.com/people/stefan.grube/blog/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework

    or is special character stops you to convert into text/plain?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Baskar,

      I believe this contentType is only for zipping. Not for unzipping, as the help page says:

      "This parameter is only relevant for compressing"

      So I don't think this is an option...

      Regards,

      Aerv