Say in front
The experiment of this article must be carried out on the premise of Internet connection!
The definition of Web service in this article is part of the "C # & asp.net" Book of Taiwan's Peak Information Co., Ltd.
Visual FoxPro 7 full support for Web Service
Visual FoxPro 7 has special support for Web service, a major selling point of visual FoxPro 7, and also visual FoxPro as Microsoft. Net architecture, a significant indicator of an efficient development tool (note: Visual FoxPro is not a. Net language, but it is. NET Framework. The Visual FoxPro 7 support for Web service is mainly in two areas: developing a Web service and a client-side tool for developing Web service. This article simply explores the client application of visual FoxPro 7 in Web service, and the content of the development Web service will be left to a later discussion.
A simple example
In this example, we will use Foxcentral, a third-party product vendor West-wind company developed by the renowned Visual FoxPro, to provide news services on Fox. Detailed information is available in the http://www.foxcentral.net.
Registering a Web Service in Intellsense Manger
I mentioned that Visual FoxPro 7 has special support for Web service, which makes it clear that visual FoxPro 7 encapsulates Microsoft's SOAP components, which you can see in detail: _webservices.vcx (Home () + "FFC \_webservices.vcx "). Web Service delivers information through the SOAP protocol, SOAP is the combination of HTTP and XML, all Microsoft Tools Access Web service to use SOAP components. Soap can be used in visual FoxPro as a way to access COM components, but this is inconvenient, and Microsoft intentionally encapsulates soap two times.
Open the Tool menu-> Select the IntelliSense Manager->types page box (Figure 1)-> Press the Web Services button:
(Figure 1)
(Figure 2)
In Figure 2, enter the Web Service Name and the contents of the WSDL URL Location. After the input is completed, press "register", the system will prompt the registration success later!
Easy Code History
To create a new PRG file, first define a variable for the Foxcentral class, as follows:
Enter the following command and press ENTER (be sure to enter):
Local Fox as Foxcentral
At this point, something wonderful happened: Visual FoxPro 7 automatically generates a series of statements.
Specifically as follows:
Local lows
Lows = NewObject ("WSClient", Home () + "FFC\_WEBSERVICES.VCX")
Lows.cwsname = "Foxcentral"
Fox = Lows.setupclient ("http://www.foxcentral.net/foxcentral.wsdl", "foxcentral", "Foxcentralsoapport")
See that--the "WSClient" class is built with an instance of "lows", and "lows" also establishes a reference to "http://www.foxcentral.net/foxcentral.wsdl".
Use this Web service
This web Service has a lot of interfaces, we just use the GetItems method, it returns an XML string, the content is the news since the day. Visual FoxPro 7 provides built-in support for XML, and we can convert an XML string to a visual FoxPro local cursor through the Xmltocursor () function, as follows:
Xmltocursor (Fox.getitems ({^2001-01-01},0,0, "all"), "Fox"
BROWSE
Well, the experiment is done.
Summarize all the code, as follows:
Local Fox as Foxcentral
Local lows
Lows = NewObject ("WSClient", Home () + "FFC\_WEBSERVICES.VCX")
Lows.cwsname = "Foxcentral"
Fox = Lows.setupclient ("http://www.foxcentral.net/foxcentral.wsdl", "foxcentral", "Foxcentralsoapport")
Xmltocursor (Fox.getitems ({^2001-01-01},0,0, "all"), "Fox"
BROWSE
Other Web Service resources
Web Service as a new technology, the application is not a lot of examples, you can visit http://www.xmethods.com/to learn more Web Service, choose a favorite, call it, feel the wave of new technology!