SOAP return with Attached File (.gz)

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
alex_rsa
Posts: 2
Joined: Mon Nov 10, 2025 2:48 pm

SOAP return with Attached File (.gz)

Post by alex_rsa »

Hello,

Excuse my ignorance of the correct terms but we only create new messages every couple of years...

We use HTTPAPI so send SOAP messages to various external partners. These messages have always had plain text in the response XML so parsing them has not been a problem.

We have now been asked to set up a new service where the response is a zipped (.gz) file attached to the XML message.

Is there a function in HTTPAPI to receive back an attached file in zipped or unzipped format or do I need to look at another tool?

Many thanks

Alex
Scott Klement
Site Admin
Posts: 945
Joined: Sun Jul 04, 2021 5:12 am

Re: SOAP return with Attached File (.gz)

Post by Scott Klement »

If they are sending you a .gz file, then you'll need to download it to the IFS and use the gunzip (g-unzip) tool from GNU or a similar tool to uncompress it. gzip/gunzip are available in PASE on IBM i via YUM and are very common tools.
alex_rsa
Posts: 2
Joined: Mon Nov 10, 2025 2:48 pm

Re: SOAP return with Attached File (.gz)

Post by alex_rsa »

Thank Scott,

Again, sorry for the ignorance here....

Can I trigger the request from HTTPAPI where the response is an attached file (zipped)?

Would the http_stmf RespStmf return the attached file data into the IFS or just the return SOAP message? If just the SOAP response where does the file end up?

Many thanks

Alex
Scott Klement
Site Admin
Posts: 945
Joined: Sun Jul 04, 2021 5:12 am

Re: SOAP return with Attached File (.gz)

Post by Scott Klement »

An attached file in web API is typically sent in a multipart format. So you'd end up with a file that is considered a multipart file containing both the SOAP XML and the attachment. Then you'd need a way to decode the multipart file into separate files, which I haven't had a need for personally, so didn't code it into HTTPAPI.

There are comercial options, for example, MDRest4i from Midrange Dynamics, that fully supports this, however.
Post Reply