40 %
60 %
Information about vfpweb

Published on September 18, 2007

Author: FunSchool

Source: authorstream.com

Visual FoxProDatabase Publishing on the Internet :  Visual FoxPro Database Publishing on the Internet by Rick Strahl West Wind Technologies http://www.west-wind.com/ Internet Development:  Internet Development Businesses are expanding their operations onto the Internet Internet Development is exploding Active, Database Applications are in high demand Why build Web Applications?Issues that make the Web hot:  Why build Web Applications? Issues that make the Web hot Distribute widely Administer centrally Universal Client Interface Application Platform of the future Limitations of Web ApplicationsOr: Two steps forward, one step back...:  Limitations of Web Applications Or: Two steps forward, one step back... Configuration issues Interface limitations of HTML Indirect data accesss through server Mostly non-visual development Server based programming model Slide5:  Browser provides the Active interface Web Server provides data / application connectivity The Internet Server API (ISAPI) is the building block for server side extensions Slide6:  Web Browser Displays HTML Server side Client side Web server Static HTML Pages ‘TheWall’ Dynamic Data and Database How the Active Web Works Slide7:  Web Server HREF='/cgi-bin/cgi.exe?Parms' Common Gateway Interface Traditional Web Interface New system process for each instance of script. (relatively slow, resource intensive) Slide8:  Web Server HREF='/scripts/isapi.dll?parms' MyISAPI (1,2..n) (Multithreaded, In-Process DLL) Loads DLL once after which it stays resident, processing multiple requests simultaneously. OtherISAPI (Multithreaded, In-Process DLL) Internet Server API (ISAPI) Extending the Architecture within the Server Slide9:  ODBC MAPI Internet Server API (ISAPI) The extension interface for IIS Getting StartedWhat you need for building Web apps:  Getting Started What you need for building Web apps Fast Pentium box (133Mhz/32-64megs) WindowsNT (recommended) Web Server Connector Interface/Application Web browser Basic HTML skills Everything can run on 1 box! Connecting Visual FoxPro DataSome of the tools available for IIS:  Connecting Visual FoxPro Data Some of the tools available for IIS Active Server Pages (IIS 3.0) FoxISAPI connector (OLE) West Wind Web Connection (ISAPI/OLE) Active Server Pages (IIS 3.0)Server side scripting for IIS:  Active Server Pages (IIS 3.0) Server side scripting for IIS Object Based Architecture Tight integration with IIS Database Connectivity with Active Data Objects (ADO) Supports external object creation Several sophisticated objects are built-in Active Server ArchitectureComponents Galore:  ASP.DLL (ISAPI Extension) Active Server Architecture Components Galore Active Data Objects (ODBC) Response/Request Objects (Input and Output) Server Object (System Services) Scripting Engine (VBScript/JavaScript) Session/Application Objects (Keeping State) Active Data Objects:  Active Data Objects Lightweight ODBC Connector Implements OLE DB (ODBC 3.5) Based on Visual Basic’s Remote Data Object It’s fast especially when tied to a persistent connection object! Implemented as Automation Object. Slide15:  ASP Scripting Engine HTML containing VBScript code Web Server ADO Data Object (ODBC Data Access) OLE DLL Server (InProcess) OLE EXE Server (OutOf Process) TClass::Tmethod() Automation Server Access HREF='MyPage.ASP' Active Server Summary:  Active Server Summary Pros: Tight Integration with IIS No hassle configuration Very easy for simple active content Cons: Code Management Automation Server Scalability Scripting Language Limitations FoxISAPIConnecting VFP Automation servers:  FoxISAPI Connecting VFP Automation servers Direct link from Web pages ISAPI DLL creates persistent Automation object DLL does equivalent of: Passes form vars in parameter Passes server vars in INI file oServer=CREATEOBJECT('TOleServer.TOleClass') oServer.YourMethod('UserId=1','c:\temp\fox2.ini') Slide18:  Web Server FOXISAPI.DLL (HREF='foxisapi.dll/Server.Class.Method') multithreaded/running InProcess Visual FoxPro OLE Server (loaded once then stays in memory) Method1 Method2 Methodn passes HTML Form Data returns HTML Document How FoxISAPI works Slide19:  DEFINE CLASS TFoxISAPI AS Custom OLEPUBLIC FUNCTION Helloworld LPARAMETER lcFormVars, lcIniFile, lnReleaseFlag LOCAL lcOutput #DEFINE CR CHR(13)+CHR(10) *** HTTP header - REQUIRED on each request! *** System Defines lcOutput='HTTP/1.0 200 OK'+CR+; 'Content-type: text/html'+CR+CR lcOutput=lcOutput+; 'andlt;HTMLandgt;andlt;BODYandgt;'+CR+; 'andlt;H1andgt;Hello World from Visual FoxProandlt;/H1andgt;andlt;HRandgt;'+CR+; 'This page was generated by Visual FoxPro...andlt;HRandgt;'+CR+; 'andlt;/HTMLandgt;andlt;/BODYandgt;' RETURN lcOutput ENDDEFINE HREF='/scripts/foxisapi.dll/TDevCon.TFoxIsapi.Helloworld?' Hello World with FoxISAPI FoxISAPI Method Rules:  FoxISAPI Method Rules Must take 3 parameters lcFormVar - HTML Form vars or ‘parameters’ passed on the URL lcIniFile - filename containing server var lnReleaseFlag - Set to keep or release server reference. Must return HTTP compliant output HTML document including HTTP header Use custom HTTP headers for things like authentication, redirection, Cookies etc. Set up for FoxISAPI:  Set up for FoxISAPI OLE Server must be registered Copy FoxISAPI.dll into script dir Directory must have Web Server Execute rights set! Run DCOMCnfg on NT 4.0 Add IUSR_ account to default rights Set user to Interactive user on the specific server Need to re-run whenever server is rebuilt FoxISAPI OLE Instancing:  FoxISAPI OLE Instancing InProcess DLL Very fast Only 1 VFP server can be InProcess MultiUse (Out of Process EXE) Slightly slower Multiple different servers Single Use Use for multiple pooled servers Same server can be instanced more than once Starter FoxISAPI classProvided on the CD:  Starter FoxISAPI class Provided on the CD Send/SendLn() Send text to output StandardPage() Generates a full HTML page ContentTypeHeader() Adds HTTP header StartRequest() Called to set up a request. Decodes input vars and clears the output property. GetFormVar() Retrieves a form variable passed in with the first parameter. GetCGIVar() Retrieves a server/browser variable from the INI file. ReleaseServer() Standard method that releases the OLE server. Slide24:  * TFoxISAPI :: TestMethod FUNCTION TestMethod LPARAMETER lcFormVars, lcIniFile, lnReleaseFlag LOCAL lcOutput, lcUserId, lcName *** Decode the Form Vars and assign INI file to class property THIS.StartRequest(lcFormVars,lcIniFile) *** Must always add a content Type Header to output first THIS.HTMLContentTypeHeader() lcUserId=THIS.GetFormVar('UserId') lcName=THIS.GetFormVar('UserName') THIS.SendLn('andlt;HTMLandgt;andlt;BODYandgt;') THIS.SendLn('andlt;H1andgt;Hello World from Visual FoxProandlt;/H1andgt;andlt;HRandgt;') THIS.SendLn('The current time is: '+time()+'andlt;pandgt;') THIS.SendLn('andlt;bandgt;Encoded Form/URL variables:andlt;/bandgt; '+lcFormVars+'andlt;BRandgt;') THIS.SendLn('andlt;bandgt;Decoded UserId:andlt;/bandgt; '+ lcUserId+'andlt;pandgt;') THIS.SendLn([To retrieve the Browser use ]+; [THIS.GetCGIVar('HTTP_USER_AGENT','ALL_HTTP'): ]+; THIS.GetCGIVar('HTTP_USER_AGENT','ALL_HTTP') ) THIS.SendLn('andlt;HRandgt;andlt;/HTMLandgt;andlt;/BODYandgt;') RETURN THIS.cOutput HREF='/scripts/foxisapi.dll/TDevCon.TFoxIsapi.TestMethod?' Method example with FoxISAPI class Slide25:  FoxISAPI Summary Pros: Full support for Visual FoxPro Real Development Environment Excellent performance Cons: Difficult First Time Configuration No Web specific code support Doesn’t run on non-ISAPI servers or Windows ‘95 West Wind Web Connection:  West Wind Web Connection Extensive Visual FoxPro framework for Web development Support for multiple sessions Works with Automation and File based messaging interchangeably Scalable across multiple machines Real-time, live debugging Server Management Slide27:  Web Browser Web Server Visual FoxPro Data Server (already loaded) Database HTML Document HTML Link wc.dll (ISAPI) Server and Form Data returns HTML Doc FoxPro User Code Scripted HTML Web Connection Data Server Slide28:  wwServer Visual FoxPro form class handles request routing on incoming requests. invokes wwServer::Process() Routes request to your PRG file MyPRG creates new Process object and calls Process method CGIProcess Class Contains MyMethod() that creates HTML output. Class can contain multiple methods. Returns HTML object To process this URL: wc.dll?MyPRG~MyMethod How your code gets called Slide29:  wwServer Visual FoxPro form that’s an OLEPUBLIC Automation Object or uses a timer to poll for requests on disk. How your code gets called Creates Process Object returns HTML object DEFINE CLASS MyProcess... Procedure Process loCGI=THIS.oCGI lcParam=loCGI.GetParam(1) *** Any ‘global processing’ here *** Check for Cookies, User Ids etc. *** Route to appropriate method CASE PEMSTATUS(THIS,lcParam,5) =EVAL('THIS.'+lcParam+'()') RETURN PROCEDURE CUSTLIST andlt;Your processing goes hereandgt; andlt;Create HTML document fileandgt; RETURN Web Connection FrameworkSome of the features available:  Web Connection Framework Some of the features available Class framework for easy access to CGI/HTML functionality Solid error handling scheme Hit Logging, Mulitple Session Management and Maintainence Routines HTML scripting from files or memos Single method output of tables to HTML Built-in support for many advanced HTML/HTTP features Slide31:  Sample Processing Code Tools summary:  Tools summary Check out Active Server for sophisticated server scripting and connectivity to VFP via Auto servers For more control use Visual FoxPro as a Web data server FoxISAPI provides powerful OLE connectivity with an easy interface For a complete Fox based Web environment check out Web Connection Slide33: 

Add a comment

Related presentations

Related pages

Visual Foxpro Web Development - Foxtools

Visual Foxpro Web Development Below you will find links to the most common methods used to take FoxPro data to the web. ... You are here: Home VFP Web. Top;
Read more

Home of ActiveVFP - Foxpro on the World Wide Web - Home

AVFP- best choice for using FoxPro with ... The goal of this project was to match or surpass the capabilities of commercial vfp web development products ...
Read more

VFPWebCrawl multi-thread?

VFPWebCrawl multi-thread? Visual FoxPro > Visual FoxPro General. ... VFP Web Crawler *New Version 1.5 with fixes and major performance enhancements:
Read more

Volunteers for Peace | Volunteer Abroad | International ...

Since 1982, VFP has exchanged more than 31,000 volunteers worldwide! Learn More About VFP. Photo Gallery; Watch Video; Photos from the Field. VFP Video.
Read more

Fate of Visual FoxPro (VFP)

Claude Fox - http://www.codeplex.com/activevfp - Open Source VFP web development. Sonntag, 14. August 2011 11:51. Antworten | Zitieren ...
Read more

VFP WEB Browser

Download Vfp Web Browser at VFP Informer: GreenBrowser, Smart Bro, simpleology BrowserBodyguard.
Read more

Challenge: Simplest VFP web application EVER! - Microsoft ...

The "complicated" frameworks that exist for VFP/Web apps are there to make things work well. A Simple VFP/web app won't be very extensible, ...
Read more

microsoft.public.fox.vfp.web - Google Groups

microsoft.public.fox.vfp.web. Showing 1-19 of 2211 topics. Listener URI Problem Publishing a web service in VFP 8. Dane Karcher: 1/18/13
Read more