This topic contains 4 replies, has 0 voices, and was last updated by ejej19 5 years, 10 months ago.

  • Author
    Posts
  • #17972 Score: 0

    ejej19
    • Contributions: 0
    • Level 1

    We have a requirement which requires us to upload PDF to an azure blob storage. We have the SAS key and was able to upload file using Rest Clients but not when using https.PUT method. File being created on the storage is somehow corrupted. We are using File.file as value of body for the request and was created from render.XMLtoPDF using BFO tags. Thanks in advance.
    This is a cached copy. Click here to see the original post.

  • #17973 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    Can you show the part of your code where you are creating objFile?

  • #17974 Score: 0

    ejej19
    • Contributions: 0
    • Level 1

    I used render module. Please see attached code

  • #17975 Score: 0

    starlingMark
    • Contributions: 0
    • Level 1

    Thanks for that. As you identified correctly in your original post, render.xmlToPdf returns a file.File object. I believe what you really want to PUT onto Azure is the content of the file. Instead of making the body of your PUT objFile, try objFile.getContents(). This will return the contents of the file as a string (base 64 encoded in this instance).

  • #17976 Score: 0

    ejej19
    • Contributions: 0
    • Level 1

    When I tried doing that, netsuite just passed the string contents (Based 64) of the file and end up creating the PDF with random based 64 text inside the blob storage.

    By the way, our current solution is to have that base 64 contents be processed on another server thru api. The webapi then reconstruct the file from that base64 and upload it to azure storage. Though it still confused as to why the https.put is behaving that way.

You must be logged in to reply to this topic.