cancel
Showing results for 
Search instead for 
Did you mean: 

sending zip file to REST API URL

sunit_s
Participant
0 Kudos

Hi Experts

I am working on File-PI-REST scenario.

PI has to pick up .zip file and sent it to REST API URL via PUT. But REST receiver channel accepts only xml or JSON format ('Data Format' Tab).

I get following error when I read zip file and select xml data format in Rest Receiver channel

'MP: exception caught with cause com.sap.aii.adapter.rest.ejb.sender.InterfaceExtensionFailedException: Could not parse message content to add interface element'

I get following error when select JSON data format in REST receiver channel

'MP: exception caught with cause java.net.SocketException: errno: 32 (There is no process to read data written to a pipe.), error: Write failed'

For picking up zip file, I am using dummy interface as I don't want to know/transform the contents. Also I cannot unzip the .zip file as its very very big xml file. We are on SAP PI 7.4 SP 12.

Can any one please suggest solution?

Thanks

Sunit

0 Kudos

Hello,

how did you resolve it please?

Accepted Solutions (0)

Answers (2)

Answers (2)

sugata_bagchi2
Active Contributor
0 Kudos

Hi Sunit,
In your sender channel use payloadzip bean to unzip the file then convert the XML inside the zip file to JSON using the receiver rest adapter.

payloadzipbean -

https://help.sap.com/doc/saphelp_nwpi71/7.1/en-US/45/da9358a1772e97e10000000a155369/content.htm?no_c...

https://blogs.sap.com/2007/02/20/working-with-the-payloadzipbean-module-of-the-xi-adapter-framework/

Thanks

Sugata

JayChan
Active Participant
0 Kudos

Hi, I guess you probably directly stream the bits and bytes to the REST receiver channel in a for format, which causing the exception.

The commonly usage to deal with this kind of situation would be Base64 Encode the binary code of Zip file.