Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deploy web service to remote Server2003 worth the effort
Message
From
12/05/2006 10:35:17
 
General information
Forum:
Visual FoxPro
Category:
Web Services
Miscellaneous
Thread ID:
01121033
Message ID:
01121324
Views:
14
Here is an article I wrote for VFUG a couple of years ago. I was having the same trouble as you. I kludged my way through the code and article, but you might find something you can use.
--------------------------------------
Setting up SOAP/WSDL

Grady McCue

This is my first attempt at an article for the VFUG newsletter. It is grounded in my struggle to get any SOAP/WSDL web server data host client/server application to run correctly. Before I get too far into this article, let me state that I am not a super VFP programmer. I consider myself to be average to intermediate. I am still learning as I program and I am thoroughly enjoying it.


For me, the road to web server based data access began when I saw the AVI of FoxPro 7.0 on the VFP web page. It was the part where the Crystal report was automatically updated over the web. Perfect! At last they were doing what I wanted to do and I ran out and bought the upgrade.

I began to try to figure out what they were doing. Nowhere in the documentation could I find a hint of where the server should reside. All the demos used ‘local host’ on the C: drive of the client. That didn’t make sense to me. I figured that if it was a server/dll it should be on the server. Right? Yet all examples, including some demonstration videos that I bought, showed the local host as the place for the server. Well, the other day I got fed up and uninstalled fox on my client machine, walked over to my server, installed my copy of FoxPro (now version 8.0 SP1) and created a virtual folder/directory. I dumped a table into my web site folder. Then I entered and compiled the code for a simple server. Here it is . . .


This is on the server and is published with the task pane


Define Class SHOWPREP As Session OlePublic && SHOWPREP is just a table name

Procedure TodaysPrep As String
Local loXMLAdapter As Xmladapter
Local lcXMLshowprep As String

loXMLAdapter = Createobject("XMLAdapter")

Use c:\YourWebSiteURL\SHOWPREP Shared && This Is Drive C: on the server


* Use SQL to get what you want from the table on the server and put it in a cursor. In this case, data that corresponds to the date

Select * From SHOWPREP ;
Where Day(Date()) = Day(prepdate) ;
And Month(Date()) = ;
Month(prepdate) Into Cursor tempprep
loXMLAdapter.AddTableSchema("tempprep")
loXMLAdapter.UTF8Encoded = .T.
loXMLAdapter.ToXML("lcXMLshowprep")

Close Tables
Return lcXMLshowprep

Endproc
Enddefine

I found the basic code in the foxpro help file and modified it to work for me on my tables. Using SQL it extracted text from a memo field into a cursor. The CursorToXML command converted the text to XML. I compiled the prg into a multithreaded dll. And saved it in a folder named ‘WebServices’. Then I started the task pane and published the web service. I uninstalled FoxPro and crossed the room to my client machine installed FoxPro and got it running. After opening my client project, I started the toolbox and selected ‘My XML Web Services’. I clicked register and set it to my web site address. Bingo. I had a connection and it appeared on the toolbox ‘My XML Web Service’. I then created a new prg and dragged the new web service to the new prg. In an instant a page of code appeared. There was a remark in it too. It said: “ * Call your XML Web service here. ex: leResult = loSHOWPREP.SomeMethod() “


Note that Intellisense will prompt you with the SomeMethod() as soon as you begin to work on that line.


Along with the generated code, this is compiled in the client application. I just call the prg with a ‘do’



I added a few lines of code:


WAIT WINDOW " Getting your data " AT 18,43 nowait
Local lcXML, lcAlias as String
Local loXMLAdapter as XMLadapter

lcXML = loShowPrep.todaysprep
** This is the primary bit of code needed and FoxPro
** Intellisense will prompt you with the most probable code.

loXMLAdapter = CREATEOBJECT("XMLAdapter")
loXMLAdapter.LoadXML(lcXML)
lcAlias = loXMLAdapter.tables.item(1).Alias
loXMLAdapter.tables.item(1).ToCursor()

SELECT(lcAlias)

I ran the code and it worked. It sucked specific data off the web server and right into my client application where I converted it for viewing in an edit box.


I sincerely hope this little article shortens the learning curve towards creating a multiuser client/web server application of your own.


I am presently trying to reverse the action. I want my users to be able to append a blank and write some text to the blank memo field on the server from the client. I would be delighted to see some examples of how this is done.


Grady McCue

--------------------------------------
>Is there somewhere I can find a clear step by step guide to deploying a web service to a remote Windows 2003 server?
>
>We have a project that would benifit greatly by reusing VFP code for data access by a web interface. We've made a web service that works very well when deployed using the wizards in VFP9 on my developer box and were starting to get excited about the possibilities until we hit a minefield trying to deploy this into a production environment.
>
>We've installed VFP9 runtimes and SOAP toolkit 3.0 (which crashes) and dug through many threads on here and elsewhere without finding a definitive step by step method to successfully do this with a VFP created DLL.
>
>Decision day is today to either get this working on a server or finally realize that VFP is dead and buried and redo everything in .NET.
>
>Help?
I ain't skeert of nuttin eh?
Yikes! What was that?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform