Compatibility between %CSP.BinaryStream and %Stream.GlobalBinary?

Primary tabs

Ensemble

Is %CSP.BinaryStream compatible with %StreamGlobalBinary because reviewing the classes this doesn't look to be the case?

What I am trying to do is zip large documents before sending over a REST interface. I compress the file and add that to an Ens.StreamContainer which is then passed to the operation to build the REST payload. We are using %Net.MimePart class to build the payload and use the BodySet method to add the zipped Ens.StreamContainer.

The issue is when the REST interface receives the POST, it doesn't recognize the data as a zip compressed item.

 

Here is the code snippet from the REST operation class:

               set oMimeBodyPart = ##class(%Net.MIMEPart).%New()               

               do oMimeBodyPart.SetHeader("Content-Type","text/plain")

               set oMimeBodyPart.ContentTransferEncoding="binary"

               Do oMimeBodyPart.SetHeader("Content-Disposition","form-data; name=""file""; filename="""_reportFileName_"""")       

               set tSC=oMimeBodyPart.BodySet(pRequest.Stream)

 

One thing I thought of but haven't tried is to use StreamSet, but I think it might require something else to map from %StreamGlobalBinary to  %CSP.BinaryStream.

David

  • 0
  • 0
  • 35
  • 0
  • 1

Answers

I'd try

application/zip

  as a Content-Type.