Skip to Content
avatar image
Former Member

How to unzip the file and convert into base64

Hi All,

I have a requirement in which I have to perform the following.

  • PI will receive a Zip file which contains 2 files (XML & JPG)
  • I need to convert the JPG into base64 and send the information to iDoc along with the XML information

Question

1) How to extract the zip files in SAP PI 7.0 sp18

2) How to process both the files i.e XML & JPG

3) How to convert JPG to Base64

Souce Structure

abc

def

jhi

Target Structure

abc

def

jhi

imagecode (base64)

Can somebody please guide me how to fulfil this requirement.

Thanks,

Iqbal

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jan 15, 2013 at 02:22 PM

    Hi,

    You should create a custom module to read the attachment and then convert it to base64 data.

    PI7.0 does not support reading attachments in mapping pipeline step.

    1) How to extract the zip files in SAP PI 7.0 sp18

    Use payloadzip bean with unzip option. Search forum for more details on usage.

    2) How to process both the files i.e XML & JPG

    payloadzip bean will extract the documents as one main payload and remaining as attachments. You can also payload swap bean to ensure JPG as attachment. Use custom module to read the attachment and then formulate a fresh payload with XML and JPG base64 data.

    3) How to convert JPG to Base64

    Search forum, there are lot of documents available for this.

    Regards,

    Praveen

    Add comment
    10|10000 characters needed characters exceeded

    • 2) How to process both the files i.e XML & JPG

      • Use payloadzip bean module in FileSender channel to unzip the file.
      • If required, Use Payloadswap bean module in File Sender, next in sequence to ensure JPG as attachment
      • Create a custom java adapter module which can read both payload and attachment and then form a fresh payload to have both XML data and base64 JPG data.
      • map this structure accordingly to idoc structure.

      Search SCN for more details on standard module usage and custom module development/base64 conversion.

      Regards,

      Praveen Gujjeti