Hi,
I need support is decompressing the response returning as content-type(application/zip) and there is no Content-Encoding set in response. In postman the response is showing me a garbage value like below. I believe since the encoding is not GZIP, Apigee would not decompress it by default. So what should be the right approach to decompress and get response in (text/xml).
The request format is also (text/xml)
message.content
�e��j�@E��MV��B���C�iI�S�j�%w�I��8��ˑ���a8a�4/f�cH ;O�nw땩��1_�Z�-�l�K�ROw�T�= �")�����,j�fy8{���|z�-e����M烻�^/6�]
Hi,
Can you describe what you are looking for with a bit more detail. Such as, are you looking for Apigee to convert the response from the target to something (possibly text) before responding to the consumer? Details such as the formats and expected behavior at each leg. Thanks!
Hi Paul,
the response from backend is coming as a zip file with content type - application/zip , its showing as encoded response as I shared.
but we want to decompress it in Apigee X and send the xml based response to client.
Please note that there is no content-encoding header returning from backend.
Hi,
Unfortunately there is not a “native” way to do this inside of Apigee. However, it may be possible to decompress the zip payload using a Java callout. You’d have to write the Java logic for it… and I’m not 100% sure that the conversion from binary to the text string needed to get the payload into an Apigee flow variable and over to Java will not break the zip structure.
A quick Google search of how to decompress zip using Java comes up with a common library to assist with it, java.util.zip.
I couldn’t find any examples of other Apigee users trying this approach out and posting how they did it though.
If the Java callout approach doesn’t work, you can likely add a Cloud Run function between Apigee and the backend. In this pattern, Apigee would handle the Consumer AuthN/AuthZ. Pass the call to Cloud run, which will call the backend and decompress the response. Then Cloud Run would return the text back to Apigee to be returned to the Consumer.
Good luck!
Hi,
Thank you Paul.
I tried with Java callout but it didnt work. Now I am trying with Cloud Run. However, the issue is response always comes as a binary value which is not getting converted using cloud run in response with {response.content}. What else can we do to handle this.