cancel
Showing results for 
Search instead for 
Did you mean: 

Unzip Base64 field from SOAP attachment with multiple files

Former Member
0 Kudos

Dear experts,

Scenario: RFC <----> SOAP

In SOAP response I am getting one of the fields as base64 encoded attached zip file which internally will have 4 .CSV files (always naming standard is same).

Now my requirement is how I should deal it with in PI mapping so that I can map relevant fields from CSV to my RFC.

Checked SCN for solution but not find solution for multiple files in zip …

Thanks in advance

Regards

Siri

Accepted Solutions (1)

Accepted Solutions (1)

former_member181985
Active Contributor
0 Kudos

Hi Siri,

You have to use a custom java mapping for response mapping as below,

1. The Java code extract the base64 zip file and it's CSV files

2. The Java should enhance exiting SOAP response message structure by adding extra structures/fields as necessary i.e., by pulling CSV files details into extended structure

3. Use this new structure further in a graphical mapping between SOAP response and RFC response

So basically, you will have two mappings for the response mapping i) Java mapping ii) Graphical mapping

Perhaps you can share a sample zip file and CSV files with bit detailed technical explanation what you want you extract and to where you want to use them for RFC response structure

//BR,

Praveen Gujjeti

Former Member
0 Kudos

Hi Praveen,

Thanks for your reply...

After recent meetings, now I got other option also... With base64 encoded filed

Either I will get .CSV multiple files (Max 4 files) in single Zip

Or

One Excel file with multiple tabs/sheets inside it, max 4 sheets

Now I am little confused on which option I should opt for better dealing in SAP PI mappings.

I feel it helps us in finding better solution...

As SOAP response is coming from ARIBA (on Cloud), with fixed structure.

I am not clear on adding new structure in rum time using Java mapping. Could you please elaborate that point on how to achieve that?

Regards

Siri

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Siri,

Choose the excel file with 4 sheets it would be easier to read as compared to reading 4 files inside a zip. There's no need to encode it as base64, just attach the excel to the SOAP request.

Regards,

Mark

Former Member
0 Kudos

Hi Mark,

Thanks for your reply..

In this case as per you, dealing with Excel with multiple sheets/Tabs is easy for PI mapping.

So,

1) I am getting SOAP response, in this Base64 field with a Zip file as attchment(Excel with multiple sheets to be read by PI)

2) I need to decode this field and Unzip

3) Read Excel files fields across multiple sheets and map it back to RFC receiver structure

I think this should be the activities required for completing mapping right? If, so I need guidance in step 3 to write UDF or Java Map to read Excel as I am not Java expert..

Best Regards

Siri

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Siri,


1) I am getting SOAP response, in this Base64 field with a Zip file as attchment(Excel with multiple sheets to be read by PI)

2) I need to decode this field and Unzip

Ask them to just return the attachment.


3) Read Excel files fields across multiple sheets and map it back to RFC receiver structure

There are lots of blogs in SDN PI space about reading an Excel file. Here's a very good blog

Regards,

Mark

Former Member
0 Kudos

Hi mark,

Thanks for your reply...

1) SOAP response can’t be changed as its ARIBA on cloud response.( They declared saying, they have option to send either 4 .CSVs in  ZIP or ZIP file with One Excel with multiple work sheets in it)

2) I have gone through most of the blogs are based on file adapter or for only specific to Single excel sheet reading not for multiple worksheets in single excel file.

Do I have any easier ways to get this?

Just other way of thinking, I am not sure of SAP team accepts it or not but..

What are the possibilities of

Sending same filed to RFC response and ABAP can read these files,

Will RFC filed accept this decoded Base64 Field?

Best Regards

Siri

Former Member
0 Kudos

HI Experts,

Can we have any simple solution for this ..

In SOAP response WSDL, I need to decode Base64 field and Unzip its attachment and save its containing .CSVs to PI local folder.

I have checked references and not able to get the code for multiple files inside of  a ZIP file.

Regards

Siri

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Siri Sha,

I think  blog will solve your problem.

Regards,

Suhale Shaik.

Former Member
0 Kudos

Hi Experts,

Instead of complex handling like Decode, Unzip, reading multiple files and map it to RFC

I am preferring to Decode, Unzip and place files into PI local folder..

If anyone can help in this kind of coding inside PI...it will be very helpful

Thanks in advance...

Regards

Siri

Former Member
0 Kudos

Hi Praveen,Mark and Suhale,

Thanks alot for your inputs..

To make my requirement simple, I have selcted this approach

1) Decode Base64 String and place generated files into PI local folder

2) read files with other interface and map it back to SAP system.

Now I achieved part 1.

and for second part, I have opened other thread as its going into other discussions

http://scn.sap.com/thread/3763584

Regards

Siri