I have a requirement to pass a blob (file) "converted to an array of bytes". From research in this community, I've tried a few things including System.IO.Memory Stream() as seen below. I've also tried the method MemptrToByteArray() which is referenced in the community many times. Regardless the appraoch I'm having difficulty getting the array to attached to the form. If I copy it back to a memptr it converts to the original file?
Any insight would be appreciated.
Best Regards,
Rod
oMemStream = NEW System.IO.MemoryStream(iSize). DO ix = 1 TO iSize: oMemStream:WriteByte(GET-BYTE(mData,ix)). END. ASSIGN oSoapDoc = NEW MEMPTR(mData) oPart = NEW MessagePart('application/octet-stream':u, oSoapDoc) oPart:ContentId = 'blob' . oPart:Headers:Put(HttpHeaderBuilder:Build('Content-Disposition') :Value('form-data; name="blob"; filename="QCDSC221.xml"') :Header). oMultiEntity:AddPart(oPart).
I think you're doing the right thing with COPY-LOB ... the fact that you're loading SOAP messages and that they're all readable bytes (characters) may be throwing you off. Try COPY-LOB with (say) a PNG or a PDF and you may see more "byte-ey" stuff.
I added an example of a multipart message with 2 JSON, 1 text and 1 image part at https://github.com/PeterJudge-PSC/http_samples/blob/master/http_client/multipart_messages/multipart_img_json_txt.p .
HTH
Peter, I was doing almost this exact thing initially. My request-raw.txt was showing the CLOB file and I was expecting to see bytes. Must be my lack of understanding. One quick follow up question as I'm trying to debug another 400 error.
All the examples show using a memptr to populate a part of the form. Is this the only object that can be used? Can you pass a char or longchar as plain/text in a form part? I couldn't find a refence in the documention? Thanks in advance, Rod
I think you're doing the right thing with COPY-LOB ... the fact that you're loading SOAP messages and that they're all readable bytes (characters) may be throwing you off. Try COPY-LOB with (say) a PNG or a PDF and you may see more "byte-ey" stuff.
I added an example of a multipart message with 2 JSON, 1 text and 1 image part at https://github.com/PeterJudge-PSC/http_samples/blob/master/http_client/multipart_messages/multipart_img_json_txt.p .
HTH