HTTP response content is zipped and sent to WM

Hope one of us all ran into this issue. WM is making a HTTP call and the response is not readable. In the response header, there is a field “Content-Encoding” in which the value is “gzip”.When this happens, the bytes/stream inside body in the HTTP response is not readable.

Is there a way in WM to parse zipped content in HTTP response into readable string?? I think this boils down to being able to unzip HTTP response in WM.

Appreciate any solution or suggestion.
Thanks.
Sandhya

The compressed http response can be inflatedusing java apis. java.util.zip or any opensource apis will work.

D.C.

To me it’s weird why are they sending HTTP response back in a zip? Did you contact the customer why they are sending like that or is it their standard way of sending response?

Yes with java API/command line utils/PSUtilities package you can unzip for files to a readable format.

HTH,
RMG

saves some network load and time ??

DC, I will probe into the zip package/class of java and let you know.

RMG, Vendor says they want to gzip in case the response is large. We are also trying to discuss with them if gzipping the response is a necessity. Since this is what they are doing with their other customers, the chances they will send without g-zipping is very minimal. I have put in place your suggestion. Due to some folder-write-permissions, we dont know yet if it unzips correctly.

Will keep you both posted on how we solved this, thanks for your suggestions.
SK

OK sure.

What type of response is that you said larger and are they sending PO response or normal HTTP 201/200 status back?

They are sending back normal HTTP 200 in status. The response payload is JSON structure. And they are gzipping it.

-SK

OK

You can use the below code as part of java service :

FileInputStream fs = new FileInputStream(“prdihub:/SrcFiles/abc.zip”);
ZipInputStream zis = new ZipInputStream(fs);
ZipEntry zE;
while((zE=zis.getNextEntry())!=null){
System.out.println(ze.getName());
zis.closeEntry();
}

zis.close();

And the above classes are available as part of rt.jar, so i believe no need to add any external jar or need to do any change in the path.
Please try above code and let us know for any issues.