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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to build web service, pronto :) 1

herbstgy

Programmer
Jan 30, 2018
62
HU
Dear All,

I have a VFP9 win32 app which works quite fine for years now. But now I'm in a situation that I have to let go the thick client and put at least some of the functions into a web page. The trouble is, I never did anything similar earlier.
So I just started to view the VFP samples about the subject and found this foxisapi.dll.
I have an IIS 10.0 that I can use here, I've put the foxisapi.dll into the c:\inetpub\scripts directory as the help directed me, then I tried to run the foxis project.
It has a proper test.htm page, which looks similar like the form in the project.
1734557057988.png
but when I press one of the buttons on top, I get this message.
1734557144077.png
I guess I'm missing something fundamental here.
Anyone care to guide me?
 
Isapi extensions are still a feature of IIS on Windows 11. From that perspective it's not outdated.

Building the foxisapi.dll from the C++ source code in \Samples\Servers\Foxisapi\Csource is also not the hard step, because you don't need to and can get it from https://github.com/VFPX/FoxISAPI

It's the configuration step to allow the foxisapi.dll to instanciate the COM Server you build from the Foxis.pjx, as described in the help, which is so outdated it doesn't work that way anymore:
...you need to run the DCOMCNFG utility to configure DCOM to give rights to the IIS service to instantiate OLE objects.

To configure Windows 2000 or later DCOM
  1. At the Command prompt, type DCOMCNFG and press Enter.
  2. In the Applications tab, select the name of the Automation server. When you build the server, the application is "employee" by default.
  3. ...
Starting DCOMCNFG I don't see an Applications tab or the "employee" application, and I did build the foxis project into a DLL and there is a foxis.employee COM class. One glimmer of hope I had was googling turned up configure the IIS application pool you define for the foxis website to enable 32bit Applications should be enough, but it still doesn't work, I get "an unhandled win32 exception occured in w3wp.exe.
 
Last edited:
If I would give the desktop app to them ("part time student workers") in any way, I would have to make serious rewrites so they can only reach the functions intended for them, or develop a separate application
In that situation, why not make a copy of the project and strip out anything not for the part time student workers? That's the simplest way to be sure there's no flaw enabling them to get into features not intended for them.

Sure, it means a light version you'll need to maintain separately, but so is writing a web appllication, so that can't be an argument.

On the other side, introducing a login and permissions on features of an application is not impossible, but clearly removing anything that's not intended for the student workes is simpler to do, isn't it? Or is that so intertwined into the forms, that it's not simple to separate out?
 
Hello,
the easiest and fastest way should be a remote access like TerminalService ("RDP")
There are others like TSPLUS which allow access via Internet in a browser and are cheaper.
 
Isapi extensions are still a feature of IIS on Windows 11. From that perspective it's not outdated.

Building the foxisapi.dll from the C++ source code in \Samples\Servers\Foxisapi\Csource is also not the hard step, because you don't need to and can get it from https://github.com/VFPX/FoxISAPI

It's the configuration step to allow the foxisapi.dll to instanciate the COM Server you build from the Foxis.pjx, as described in the help, which is so outdated it doesn't work that way anymore:

Starting DCOMCNFG I don't see an Applications tab or the "employee" application, and I did build the foxis project into a DLL and there is a foxis.employee COM class. One glimmer of hope I had was googling turned up configure the IIS application pool you define for the foxis website to enable 32bit Applications should be enough, but it still doesn't work, I get "an unhandled win32 exception occured in w3wp.exe.

approximately this is where I stuck too.
 
I think you'd need an upgrade of the foxisapi.dll to get this going, and that would need some digging in how this interface with IIS works. While some of the necessary C/C++ knowledge is in the source code of the foxisapi.dll (not the Foxis VFP project, but the foxisapi.cpp file), that's still a show stopper to me.

And the way foxis gets its form going in html is also only a sketch of how to do it and not a framework you can simply use as is for any other form you have and let any form run as HTML form, easily. So even getting isapi going, you still start from scratch in HTML, which means you can also do things in a current web development stack like described here: https://www.imaginarycloud.com/blog/tech-stack-software-development

It's all new waters, you don't get around it, even if the foxis example still would work. If it would, yes, you could use a lot of VFP development you know, but still your frontend is HTML, not VFP controls.

It would be easier to host a VFP applilcation with FoxInCloud. But then you'd host a VFP application, so you're still confronted with making one for the students with lower permissions. And if you have that, you can give it to them as a desktop version, no need for a web version anyway.

So, to make the major point: Even if you have something that turns your desktop application into a web application, you still have the issue you need a limited student version. But you want to make a first stab in turning a VFP form into a web form without needing to learn any web related stuff? What's that all about?
 
Last edited:
Perhaps you need a few clarifications what you only get, if this is working:

Foxisapi.dll is built from cpp code and is a helper DLL that enabled web http requests arriving in IIS to reach to VFP by instanciating a VFP COM server dll.
Foxis is not foxisapi. It's a sample project making use of foxisapi.dll by building into a VFP COM Server DLL or EXE which then is run by foxisapi.dll.

Foxisapi does not run an SCX or VCX, it forwards the http request to a COM server method in the VFP code. A given example URL in the help is /scripts/foxisapi.dll/FoxIS.employee.startup. which first arrives in the foxisapi.dll with the last part (FoxIS.employee.startup) as paramter And tells it to create the Foxis.employee OLE class and call its startup method. That's not the stsrtup of the whole VFP application, that's the starting point of showing the employee form in HTML. You got there somehow, halfways, in your screenshot.

But take a closer look at what's in there:
1. the employee class in the employee.vcx of the foxis project is indeed an OLE Public class.
1735732814160.png
The employee.startup method is inherited from the general (framework) class isform.startup, that's this code:
Code:
LPARAMETERS p1,p2,pDisp
thisform.Errorhtml = "" &&reset error property
IF TYPE("m.p1") = 'C' AND m.p1= "ASP Cookie"
    thisform.fASP = .t.    && started from an Active Server Framework page
    * use the ASP generated cookie
    thisform.cookie = SUBSTRC(m.p1,RATC("=",m.p1)+1)
ELSE
    thisform.fASP = .f.    &&started from an HTML page
    pDisp = thisform.nReleaseServer    && signal the client to not release this instance
    thisform.inifile = m.p2
    thisform.cookie = this.MakeCOOKIE()
ENDIF
thisform.GenHtmlStats(m.p1)
thisform.log("startup" + IIF(type("m.p1") = 'C',m.p1,""))
SELECT (thisform.dbfalias)
LOCATE
this.writeCookieInfo
return this.GenHTML("FORM")
It ends in this.GenHTML(), which generates HTML of the form. But this method is far from being mature to turn any form into HTML, no matter how little you care for the looks, if it just works. You still have almost nothing to start with. I spare to post the GenHTML method code. It looks complex, but it's not even close to getting any VFP form to a HTML representation.

And forget to get any interactivity code of the form run. Let's assume the best case scenario, where any form could be turned into HTML, a HTML form is still void of any mouseover code in the VFP form, any click code of buttons. The only main action a HTML form can do is submit it's content to the webserver and let it process that. In short: There is only HTML generated here, not JS that would reflect all the interactions the form does with itself in any control events. Even considering adding the necesary JS. there is no easy 1:1 html/js equivalent of a VFP form and the foxis genhtml code is far from a complete framework of translating the actually running VFP form class to HTML and let that HTML represent the VFP form running server side and letting the user interact with it, though the user is not seeing the VFP form, just the partial imperfect html representation of it.

The forms of the foxis project are limited in comparison to what VFP forms and controls can do, so that this GenHTML method is sufficient for the foxis forms. One little more detail: It all works based on VFP control objects, some of which provide their own GenHTML method, but it won't do anything for legacy screen forms not using the VFP form and form controls, objects. GenHTML uses AMEMBERS to get all member objects of a form and then iterates over them. You don't get anything from AMEMBERS from a legacy screen.

So in summary: Even if you get the foxis sample to run, you don't know how disappointed you will be in the end, as it's not providing a simple and easy way to turn any VFP form into a web equivalent. You expect too much of this sample.
 
Last edited:

Part and Inventory Search

Sponsor

Back
Top