+ Start a Discussion
VarunCVarunC 

External Web Service download a file problem

I'm trying to integrate an external Web Service API into force.com. In that webservice I can get COntent of a File, my issue is how can I create a Visualforce page and APEX class such that I can get my force.com users to download the File. The file can be txt file, pdf file, excel file or anything. :( .... help ...

MandyKoolMandyKool

Hi,

 

I am not an expert in webServices, but as per my understanding you are getting the contents of file from the web service.

Your porblem is how to show them to the users so that they can download the file?

 

If my understanding is correct, then you can have a Visual Force page on which there will be a "Get Content" button, on click of this button your web service will be called, which will return the contents of the file.

 

Once you get the contents of the file, you can create an attachment from the contents of the file. You can use any dummy object and attach that attachment to that object. 

 

on the same Visual Force page(below your "Get Content" button) you can show a page block in which you can show the attachments, from where user can download the attachments.

 

Please correct me If I am missing something!!!!

 

Thanks,

Mandar

 

 

VarunCVarunC

Thanks for the reply .. this introduces unnecesary extra steps, and is not an idle solution :( ... this would require user to first get file from web service and then click again to download file .... can you suggest any client side javascript solution you know of ... which will download the file and show user file save dialog on link click?

dleonp@adcapital.cldleonp@adcapital.cl
Hi.

Finally could you solve your problem?? I'm facing exactly the same right now and I can't find any solution.
Any help is appreciated.
Best Regards,
Daniela.
willardwillard
<apex:page controller="ViewIOController">
    <apex:pageMessages />
    <apex:outputPanel rendered="{!content != null}">

        <apex:iframe rendered="{!NOT(isImage)}" name="{!filename}" src="data:application/{!extension};base64,{!content}" width="100%" frameborder="0"/>-->
    </apex:outputPanel>   
</apex:page>
Here's my code that I got from somewhere (don't remember where).  I'm like 80% the way there on this issue.  The issue here is that the downloaded file has a filename of "download" with no extension on it.  I tried adding a title and a name, but it doesn't seem to take.