How to download a .zip attachment returned by an HTTP API call and parse it in webMethods?

I’m developing a webMethods service in wemtehods 9.8, where I’m calling an API via pub.client:http, and the output expected is a .zip file (having data in JSON format) which I need to download, parse and store some of the data in a DB.

When I use pub.client:http, I’m getting bytes and stream as output. I’m able to convert the bytes to a string using pub.string:bytesToString, but I see only junk data in the output string. Can someone suggest how to download an attachment in webMethods returned by an API?

zip file content is in binary format. You shouldn’t convert it to String. Just save the bytes to file directly or unzip it and do whatever you want.