cancel
Showing results for 
Search instead for 
Did you mean: 

Decode Base64 at field level!

Former Member
0 Kudos

Hi,

I am getting a soap response from webservice where one particular field will be encoded in base64 format.

While mapping I would like to decode this into binary format.

Please advise the procedures.

Regards

Anandh

Accepted Solutions (1)

Accepted Solutions (1)

subhro_de
Active Participant
0 Kudos

Hi Anandha,

If you are using the sap util libraries i.e. aii_utilxi_misc.jar - import this in imported archive  - import/mention this in the Archives Used tab in the screenshot below.  In the Import Instructions mention - com.sap.aii.utilxi.base64.api.Base64 and create a udf as shown below (add exception handling).

This udf can then be used in your mapping for decoding :

If you want to use apache libraries - Go to the functions tab and add  the import - org.apache.commons.codec.binary.Base64.

Create a udf in similar lines  - where encoded is the input field value :

byte[] decoded = Base64.decodeBase64(encoded);

String decodedout = String(decoded);

return  decodedout;    

Regards

Subhro

praveenkva
Explorer
0 Kudos

HI,

How to get the com.sap.aii.utilxi.base64.api.* in the Import instructions of functions in SAP PI.

and also please let us know where to get this jar or class file.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Anandh,

You need to implement a UDF or Java-Mapping to do the decoding. Please search on SDN, you will find some discussions.

Best Regards

H.