Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing DBF's Remotely

Status
Not open for further replies.

AlastairP

Technical User
Feb 8, 2011
286
AU
I have recently done a lot of development involving sending and retrieving data to a remote server using HTTP Requests in JSON format.

I have some windows tablets that our techs use in the field to access the VFP database remotely over a VPN. So what would be great is if I could get these tablets to access the VFP database in a similar way using HTTP requests, instead of creating a direct connection as it does over the VPN. I can see a lot of advantages for this including retiring the windows tablets in favour of Android devices in the future.

I have very little idea of what is needed to make this happen.
Has anyone done anything like this and can provide some direction?


With regards

Alastair

 
VFP9 in fact comes with all tools needed to create VFP based Soap services. Those were (are) XML based, the principle of a JSON REST API is actually even simpler.

There is no general DBF REST API I have heard of, but maybe just because it's easy enough to establish running VFP on a Web server with one of the solutions made for VFP on the web. Rock Strahl's Web Connection is maybe the most used library in that aspects, exists for very long, is very stable and the latest release I see on is from September this year. Just like VFP itself it's not under further development, but Rick obviously still serves with maintenance releases.

The page also mentions "Create JSON REST Services". If I'd not want to dig into the details of foxisapi (part of VFP Samples) I'd go for that and base my JSON Rest API on it.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Hello,

Olaf ist correct, WestWind and Webservices would be best.

Depending on your needs there maybe other ways :

a) Command
Imagine "command directories", one for each user.
The user creates and transfer a request file (.txt with Ids to get from server,...), maybe even by using a simple ftp tool.
On a "server" a VFP program polls this directories for requests, analyses them and writes a response file (.txt, pdf, dbf, csv)
User gets this file via ftp or vpn connection and opens it with local excel/acrobat,editor ... on his tablet.

If the requests are simple, you do not even need a program on tablet, writing request file with text editor and transfering it with ftp tool is enough.
Maybe good old total commander is ok for both.

And the response tool, polling on a "server" is easily done in VFP.

b) Remote access
a full featured program in central office on a "server" and a remote tool like Teamviewer, Anydesk, remoteplus, on Tablets and server.
So programming stays in VFP database world.


Regards
tom

 
Hi Tom,

Thanks for the tips
Option B has been suggested a few times but has been discounted -
• There is already a fully functional application on the tablets​
• The techs are in buildings where the internet connection is unreliable (basements, stairwells etc)​

Option A was something I previously thought about (Something on a similar style) at the time and still has some merit. I am thinking it would not be that hard to implement as we already have a VPN setup. It would solve the problems in the short term and give me some time to concentrate on JSON and REST, creating DBF & REST servers etc.

Because I would like to retire the windows tablets in favour of android phone or tablets, I am thinking that JSON and REST would be best moving forward.

I have looked at WestWind Webservices and yes that would perform most of the functions I need.

Alastair
 
Just FYI:

It's not that hard to get the foxisapi.dll up and running, even with an Apache webserver (On a Windows OS, of course).

is a good starting point.

Things to change/add to an Apache httpd.conf file:
Code:
ScriptAlias /cgi-bin/ "C:/path/to/webroot/cgi-bin/"
...
AddHandler isapi-handler .dll
The comments in the httpd.conf file tell a bit more, especially not forgetting the ExecCGI in the Options directive to enable executing something via CGI, also refer to which again points this out.

Notes: Apache works with slashes in path names, also on Windows. And really just set the isapi-handler to react to any .dll, you don't specify the foxisapi.dll here, just the .dll extension.

The method you define has to return http response text starting from the Response Headers and continuing with the response text, that doesn't have to be HTML, can also be JSON, of course.

I still think web connection will make it easier especially not to fiddle with all the HTTP protocol details yourself. The interfacing with foxisapi.dll seems a bit outdated, it creates an INI-file, that you get as parameter and that contains informations a usual web script would know as server variables, the major input, either the URL parameters of a GET request or the request body of a POST request come in the first parameter of the COM Server method you define, in the wiki example the lcFormVars variable. And that could be a VFP script your server executes with EXECSCRIPT or anything you want the vfp server to execute.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top