Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Restful API
Message
De
18/06/2013 08:20:37
 
 
À
18/06/2013 07:38:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01576581
Message ID:
01576605
Vues:
57
It really should be pretty straightforward - especially if you can just pass the file name to upload/download from vfp to .NET.

Just create a 'class library' project and expose public methods to upload and download (passing in the filename).
You can easily test it in a .NET environment by running it from a console app. Once your happy with that than register it for COM interop (on the properties 'Build' page) and you should then be able to load it as any other COM object from VFP.....

>Thanks, you are making a BIG assumption there ;)
>
>>Since you know .NET then you could handle this with a HttpWebRequest in a DLL and expose it as a COM object to VFP ?
>>
>>Update: The first code snippet here is pretty much it : http://msdn.microsoft.com/en-us/magazine/ee309509.aspx
>>
>>>Hi,
>>>
>>>I have been asked to use a restful API (I believe that's what it's called to retrieve and post files to a folder on the web - or in the cloud as is the common term now).
>>>
>>>How do I do this from VFP?
>>>
>>>I have been given the following information:
>>>
>>>Viewing:
>>>
>>>To view a document simply go to the following URL. It will output a pdf file.
>>>
>>>http://***.***.***.***/api/index.php/documents/index/
>>>
>>>Example of a live document:
>>>
>>>http://***.***.***.***/api/index.php/documents/index/8CF8797D-4FDF-7A4C-3750-4C8BFF1A4BC4
>>>
>>>Uploading:
>>>
>>>To upload a file you have to do a HTTP POST to this URL:
>>>
>>>http://***.***.***.***/api/index.php/claims/upload
>>>
>>>It expects 2 parameters:
>>>
>>>doc_pk - the primary key for the field in the ClaimDocuments table which holds the description etc on the document
>>>pdf - this should be a base64 encoded string of the contents of the file to upload
>>>
>>>This is a sample of the code I use to upload a document:
>>>
>>>$response = $this->rest->post('claims/upload', array(
>>>'doc_pk'=> $doc_pk,
>>>'pdf' => base64_encode(file_get_contents('resources/img/doctors.jpg'))
>>>), 'json');
>>>
>>>As you can see I first read the contents of the file, then encode it, then send it to the RESTful server.
>>>
>>>The server will return a response in JSON. This is the php dump of that response:
>>>
>>>stdClass Object
>>>(
>>>[error] => false
>>>[message] => File uploaded successfully.
>>>)
>>>
>>>The error variable will be true or false. The message will correspond to the error state.
>>>
>>>To force an error you can POST to the URL with no variables.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform