I would recommend the use of the REST connector for this kind of operation, but if you have a need to use ArcScript operations, you’re going to find that the http:content output parameter of the httpGet call is only useful for string data.
If you intend to download a binary file, you will want to set the localfile parameter input to the operation, to instruct the operation to write the contents to file:
<arc:set item="httpGetInput" attr="url" value="[params.pdfUrl]" /><!-- use a path you have access to, and if you expect to call this script in parallel use a unique name --><arc:set item="httpGetInput" attr="localfile" value="/tmp/test.pdf" /><arc:call op="httpGet" in="httpGetInput" out="response"> <!-- reference the output by filepath for binary content --> <arc:set attr="output.filepath" value="/tmp/test.pdf" /> <arc:set attr="output.filename" value="test.pdf" /> <arc:push item="output" /></arc:call><!-- clean up after yourself --><arc:set attr="del.file" value="/tmp/test.pdf" /><arc:call op="fileDelete" item="del" />
Are you certain the good.pdf being referenced here differs from what is output?
If you are using a Script connector and pushing a binary file to the output, setting the filepath parameter on the item you wish to output is the right approach. Whereas setting the data attribute of the output item will encode the field as a string, setting the filepath parameter simply references the contents of the file, by for byte.
If you’re still seeing an issue, please open a support request with us at:
Sorry, not sure if you saw my update to my last comment, clicking the output file in the Script Transactions tab, the PDF is good. I can download from there and it renders as expected and is the correct size. So something is happening after the script connector, but I have nothing there:
I see; this is part of a Flow API - the Flow API is not designed to return binary file content in the output.
This is something that we are considering in future versions of CData Arc, but if you want to return binary file content, you’re going to need to implement a layer of encoding in the response so that the file is returned in a format that will preserve all of the bytes as a string (Base64 encoding is recommended).
You can either output the Base64 encoded contents directly to the output:
Oddly enough, that was my next task, converting the pdf to base64, wanted to make sure I could get the PDF in original format working first. I will try that now. Thanks for your help James.
This website stores cookies on your computer. These cookies are used to collect information about how you interact with our website and allow us to remember you. We use this information in order to improve and customize your browsing experience and for analytics and metrics about our visitors both on this website and other media.
Review section III of our Privacy Policy for more information on cookies.
To opt out of “sale” or “sharing” of non-cookie data, visit our Privacy Rights Request Form.