How to insert PDF files in Rest WS - EXEC_REST_WS

SUGGESTED

Hello, I use the EXEC_REST_WS function to send a json to a REST web service but I don't know how to insert a pdf file.

There is a parameter in the function (Clbfile DATA) to pass parameters in json format, but I don't know how to insert a pdf file into the clbfile. Does anyone know how to do it?

Thanks and regards.

Parents
  • 0
    SUGGESTED

    Hi Toni, 

    A possible solution. 

    Read the pdf file content into a Blob.

    Then encode the blob into a clob  in b64

    In other side you may need to encode it

    Local Blbfile FIL_BLB(10)
    Local Clbfile FIL_CLB
    Local Integer LENGTH
    Openi YOURFILEPATH Using [ZFIL]
    Getseq 10,[L]FIL_BLB Using [ZFIL]
    Openi Using [ZFIL]

    [L]LENGTH=b64Encode([L]FIL_BLB, [L]FIL_CLB)

Reply
  • 0
    SUGGESTED

    Hi Toni, 

    A possible solution. 

    Read the pdf file content into a Blob.

    Then encode the blob into a clob  in b64

    In other side you may need to encode it

    Local Blbfile FIL_BLB(10)
    Local Clbfile FIL_CLB
    Local Integer LENGTH
    Openi YOURFILEPATH Using [ZFIL]
    Getseq 10,[L]FIL_BLB Using [ZFIL]
    Openi Using [ZFIL]

    [L]LENGTH=b64Encode([L]FIL_BLB, [L]FIL_CLB)

Children