HTTP POST + attachments

Posted by xjg on 28-Sep-2017 09:10

Hello,

I am working in a Procedure to send an HTTP Post request with an attachment included. I am using the MultipartEntity class in order to create a MultiPart HTTP request so I could be compliant with the requirements given.

At some point, I'm trying to do this:

lvc_Filename = "myTestPdf.pdf"

/* File part */
lvo_AttReqPart = new MessagePart('application/pdf', XXXXXX).

lvo_HdrPart = HttpHeaderBuilder:Build('Content-Disposition':u)
                 :Value(substitute('attachment; filename=&1':u, quoter(lvc_Filename)))
                 :Header.


lvo_AttReqPart:Headers:Put(lvo_HdrPart).

 

So, I'm trying to create a MessagePart Object containing a PDF file, my issue is that I don't really know what should I put in the XXXX in order to successfully transfer my pdf file.

I've tried with a MEMPTR where I've done a COPY-LOB from my file but is not working neither I was sure if that binary structure could be understood by the server side.

Does anyone knows how should I proceed?

 

Thanks in advance!

Posted by Peter Judge on 28-Sep-2017 10:46

Take a look at github.com/.../multipart_img_json_txt.p  . the 3rd part as an image (ie uses a file  from disk).
 

All Replies

Posted by Peter Judge on 28-Sep-2017 10:46

Take a look at github.com/.../multipart_img_json_txt.p  . the 3rd part as an image (ie uses a file  from disk).
 

Posted by xjg on 29-Sep-2017 03:14

Hello Peter,

thanks for your help, you made my day!

This thread is closed