cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Image read from file adapter to BASE64 string

Former Member
0 Kudos

Hi Experts

I have a requirement to read an image file from folder through file adapter, then converting it to base64 string and passing this encoded string inside a field in target mapping.

Could you please help/suggest possible ways?

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member181985
Active Contributor
0 Kudos

Hi Vishal,

Option1: You can follow Hareesh's solution. However, I recommend to use SAP's Base64 inbuilt class instead of 3rd party base64 implementation class. Use com.sap.aii.utilxi.base64.api.Base64 class which is available in com.sap.aii.utilxi.core.jar file

You can download this jar file from XI system using browser 


http://<xiserver>:<port>/rep/repository/com.sap.aii.utilxi.core.jar


Option2: Create a java mapping using SAP's base64 class and then formulate target message using normal java string api (or) SAX/DOM api

Best Regards,

Praveen Gujjeti

former_member184720
Active Contributor
0 Kudos

Was not aware of this class "com.sap.aii.utilxi.base64.api.Base64".

Nice to know.. Thanks Praveen

former_member181985
Active Contributor
0 Kudos

Cheers

Former Member
0 Kudos

You can also use ITEXT API's to acheive this

former_member184720
Active Contributor
0 Kudos

May be read the file as an attachment(additional files) and during the mapping and write a UDF to read the image file and translate into BASE64 ecnoded string.

To read the attachments within mapping:

To convert into base64 string using Apace IO Utils.

How to convert Image to String and String to Image in Java? - myjeeva.com

If you can't read the file as attachment go for the java mapping and handle everything there.