WEB WebServices in Visual Fox Pro 9 0
WEB Web-Services in Visual Fox. Pro 9. 0 Fox. Pro User Group of German language Rainer Becker Presentation at SDN 15 Sep 2006
Working with Web. Services n n Friday, 15. 09. 2006, 13: 00 – 14: 15 Visual Fox. Pro is most often used for rapid application development of Desktop-applications but also for Client/Server applications, both sometimes running on Terminal Services for ease of deployment. But you can also create Web. Services with this powerfull development environment without any problems! The fast database and string functions allow the creation of fast services for distributed applications.
Rainer Becker n d. FPUG n n n n Online offers Loose Leaf Magazine VFP-Dev. Con VFP-Lokal/Develop Framework Visual Extend MVP, MCP, ISV Wizards & Builders Gmb. H
Where do I get VFP ? n Update from 6. 0, 7. 0, 8. 0 or VS 97 n n International or US/Canada-Version n n Not for VFP 5. 0 or older different pricing technical identical no problem in The Netherlands d. FPUG offers localization n we could create a Dutch version if someone is interested…
Topics n n n n Existing Web. Services Calling Web. Services Definitions and versions Preparation SOAP-Toolkit IIS-Configuration Additional hints Other ways to skin a cat
Remarks n You always need a COM-Server! n n n Creating COM-Servers is a different session… Please create a COM-Server first and test it… and maybe have a look at existing Web. Services… The calling logic in the Internet is different in general. Therefore business objects are not really usable if they are not designed for one-time-calls. Separate COM-Servers are often easier to use! Web. Services have to be strongly typed which is only optional for COM-Server, maybe create a separate PRG with For deployment you always need a Windows Webserver in the Internet…
Existing Web. Services n Instead creating a Web. Service directly you should first have a look at existing Web. Services, e. g. : n n n n Fox. Wiki (http: //fox. wikis. com) Universal Thread (http: //www. universalthread. com) Pro. Fox (http: //www. leafe. com) Fox. Central (http: //www. foxcentral. com) Google, Amazon, e. Bay, Fed. Ex, Who. Is, Currency. Converter, Babel. Fish, Headline News d. FPUG-Portal (see http: //apf. dfpug. de) d. FPUG-Forum (see Visual Extend example)
And Again: The Task. Pane!
Client for Web. Services n n Interactive Testing with the Taskpane Integration into your own forms: n n n Open the Form Open the Toolbox Drag & Drop the class Web. Service onto the form Select the object with the mouse Right mouseclick for Builders Call the XML Web. Service Builders
Web. Service-class in your form
Testing: n n n Enter parameters View results as XML View results in Grid
Match parameters and output
Use complex data
Thats it for calling a Web. Service n n Since Visual Fox. Pro 8. 0 there are powerfull tools that support developers in calling Web. Services… Before creating your first own Web. Serivce have a look… This could easily fill a another complete session… There are multiple articles available as well as the updatebook for Visual Fox. Pro 8. 0!
Definitions n WSDL: Web Service Description Language n n WSML: Web Service Meta Language n n n COM-Reference, see Program FilesMSSOAPSOAP. CHM UDDI: Universal Description, Discovery, Integration n n XML-description similar to a COM-server definition List of available Web. Services, seldomly really used SOAP: Simple Object Access Protocoll SOA: Service Oriented Architecture
Version History n n n Introduction of Web. Services in: Visual Fox. Pro 7. 0 with SOAP-Toolkit 2. 0 Current: Visual Fox. Pro 9. 0 mit SOAP-Toolkit 3. 0 Lifecycle-Support n n n Visual Fox. Pro 9. 0 till 2014 SOAP-Toolkit till 2013 (for VFP ONLY!) In the future: Web. Services via INDIGO n n With Win. FX as Add. On for XP as well as in Vista encapsulates VFP-Web. Services completly in. NET n this even includes runtime file inclusion/distribution/registration
Usefull Web. Services in Apps n Examples from the Framework Visual Extend 9. 5: n n n n Posting of messages in Support-Forum Sending of error messages to error database Registration of users for trial version Orders of users (update from trial to full version) Download of Updates If Internet or Web. Services (Firewalls!!!) not available e. Mail is used instead… No Web. Service needed for VFX-Taskpane… n Active Fox. Pro Pages used instead, see http: //afp. dfpug. de
Prepare a COM-Server n n Creation option: Multi-Threaded COM-Server Minimum 1 x OLEPUBLIC 1 Web. Service per OLEPUBLIC Max. 1 Webservice
Web. Service Creation n Projektinfo Servers: n n n Multi-Use Project Name Multi-Threaded and Multi Use: needed for Internet due to RAM constraints!
Web. Service Publishing Wizard n Call the Web. Service. Builders in project n n n Check the path Opt. Select a class Opt. additional options
Extended Options n n Optionally use extended options: Switch to ASP Project. Hook n n n Wsphook in _webservices Save in table FOXWS. DBF in _FOXCODE Create Intelli. Sense. Script
Virtual directory in IIS n n n Created automatically for you Differences between Path, virtual directory and startup directory! Ask you administrator <g>.
Builder Results n n n . WSDL (Description). WSML (Meta/COM) Opt. additional ASP -page n n will be called directly Project. Hook for regeneration each time you change
Register at Intelli. Sense n Register the class under Types / Web Services in the Intelli. Sense- Manager
Call the Web. Services n Intelli. Sense creates the needed Code for you: n and shows all methods that can be called…
What can go wrong? n Potential problems (OLE-error messages): n n n with paths: Windows/System 32 (Runtime) CD JUSTPATH( _VFP. Server. Name) Problemes with SOAPISAP. DLL (install or use ASP)
Registration of Listener (1) n Registration of SOAPISAP. DLL for performant ISAPIListeners: 1. Default-Website, Properties, Home Directory 2. Button Configuration 3. Select the extension. WSDL
Registration of Listener (2) n Select C: Program FilesCommon FilesMSSoapBinariessoapisap. dll If not visible: Select e. g. INI and change it n NOT on Win. XP… n
Alternate Call: SOAP-Client n n Instead of using the classes of Visual Fox. Pro you can also directly access Web. Services via SOAP-Client: Code example: lows = NEWOBJECT("MSSOAP. Soap. Client 30") lows. MSSoap. Init( "http: //dlab. homeip. net/webservices/dlab. wsdl") ? lows. timechecker() n Much easier way to call but you have to do it yourself
Integrating minimum security n n n Internet Information Services Properties of virtual directory Page Directory Security n n n Disable anonymous access Enable standard authentication Or extend the above code example: lows. Connector. Property("Auth. User") = "username" lows. Connector. Property("Auth. Password")= "password"
Type declaration important! n Strong typing required for parameters/return value n n n can only be done programmatically, see COM FUNCTION getnews (ld. Date as Date) as String Re-Publish via Wizard necessary so that <message name='hwpclass. getnews'> </message> n is changed to the correct new definition for you: <message name='hwpclass. getnews'> <part name='ld. Date' type='xsd: date. Time'/> </message>
Call COM-Server indirectly n Create a programm to call the COM-Server DEFINE CLASS My. COMInterface AS Custom OLEPUBLIC FUNCTION My. Method (My. Parm AS String) AS String LOCAL o AS myclass o = CREATEOBJECT("myclass") RETURN o. My. Method(My. Parm) ENDDEFINE n Now you can change the COM-Server as often as you like without having to republish it (if interface remains the same)
Creation: Release the DLL n n n Computer Mgmt: Restart IIS or: IISRESET at the DOS-Prompt or: KILL. EXE to remove DLL from memory without questions asked
In a lot of case you can have an easier start Multiple examples available at http: //afp. dfpug. de
Creation of AFP-Pages n n Using Visual Fox. Pro as a script language in HTMLPages with Active Fox. Pro Pages (AFP/AFX): <% Fox. Pro-Code %> See examples at http: //afp. dfpug. de n n Create pre-formatted HTML-tables with parameters Return RSS Return XML See usage examples at http: //portal. dfpug. de
Web applications: VFX–AFX Wizard n Internet-forms via mouse click! Prerequisites: n n VFX 9. 5 and VFP 9. 0 SP 1 AFX n n like ASP, but based on VFP IIS n Fox. Pro-version under creation for AFX Scalability: n via AFP for multipel parallel users / AFX for 10 users
Articles n n n n n 02 -16 Creation of Web. Services in Visual Fox. Pro 06 -15 Program your Data 06 -32 Searching with Web. Services 06 -35 Publish your first Web. Service 1 06 -36 Publish your first Web. Service 2 06 -37 Publish your first Web. Service 3 07 -16 Search with VFP in Google 01 -03 Working with Web. Services in VFP 7 (New 18) Extensions of COM and Web. Services in VFP 8. 0 Whats New in Visual Fox. Pro 7. 0 Chapter 15
Additional material n Visual Fox. Pro 9. 0 n n Visual Fox. Pro 8. 0 n n Update book Articles n n n Fox. Talk Fox. Pro Advisor Fox. X Professional (German)
Thank you very much! Send questions hotline@dfpug. de or (better) http: //forum. dfpug. de Visit our websites: http: //www. dfpug. de, http: //portal. dfpug. de, http: //forum. dfpug. de, http: //newsletter. dfpug. de, http: //devcon. dfpug. de, http: //roadshow. dfpug. de, http: //www. visualextend. de, http: //www. linuxtransfer. de, http: //www. visualfoxpro. de
Riddle of the day ? CHRTRAN('S 6 O 1 W 2 S 634 G 5789', '6789', 'TIME()'), '12345', 'PAINT()')
- Slides: 40