Web Service written in. NET using the Visual FoxPro resource-VFP

Source: Internet
Author: User
Tags generator soap new features resource wsdl

Part III: in. NET in the use of VFP written Web service

. NET and Java to be able to sell across different platforms, Java seems to pay attention to the cross-platform nature of the code itself. NET is more concerned with the cross-platform data, so. NET holds the banner of XML Web service in front of us, and in a sense. NET is an XML Web service.

Visual FoxPro support for XML Web service is based on MS XML and SOAP components, and the core of writing Web service with Visual FoxPro is the COM component programming mentioned above. Just publish the COM component as a Web Service, OK!

Based entirely on the original knowledge, developers need to be aware that COM can retain state while Web service is a stateless system that must be noted when designing COM components used by Web service.

To facilitate the development of XML WEB service clients and server-side programs, Visual FoxPro 7 offers a range of personal design:

    • The built-in more affinity Web Service Publishing Wizard replaces MS SOAP's WSDL generator utility.

    • Provides a WEB service project framework to facilitate rapid development of server-side programs.

    • Provides a project Hook class that facilitates developers to compile and redistribute Web Service more than once.

    • IntelliSense supports importing WSDL files, which greatly facilitates the invocation of Web service.

    • SOAP is encapsulated, combining IntelliSense technology to automatically generate initialization code when invoking a Web service.

There are also some details to note that Visual FoxPro 7 supports COM object interface implementation, which facilitates the processing of SOAP header information, supports a variety of encoding and decoding including BASE64, facilitates data conversion, and, of course, built-in XML support that has been mentioned earlier.

Now we publish the previous COM build foxwebservice.dll as a Web Service. You can use the visual FoxPro built-in Web Service Publish Wizard (Tools->wizards->web Service), or you can use the WSDL generator. It is important to note that the built-in Publishing Wizard only supports SOAP 2, and if you need to take advantage of the new features of SOAP 3, you must use the WSDL Generator tool for MS Soap (soap 3 just launched, Visual FoxPro, and update the Web Servicepublish Wizard). For this example, the version of Ms SOAP is not cared for.

Invoking Web Service in. NET requires the creation of a proxy. Execute such a statement at a command prompt: (code#10)

Wsdl/language:cs/out:customer.cs Http://localhost/cust/customer.WSDL

So we get the proxy file Customer.cs for our web service, and then compile the file: (code#11)

Csc/out:customer.dll/t:library Customer.cs

The next step is simpler, as long as you use this proxy object in your code, for example: (CODE#12)

Customer Obis=new customer ();
DataSet ods=new DataSet ();
Note It is very simple to convert the recordset represented by XML into a Table object.
Ods.readxml (new StringReader (OBIS). Getcountry ()));

The following statement needs to be executed at the command prompt at compile time: (code#13)

Csc/t:winexe Webs _client_sample.cs/r:customer.dll

Web Service is a simple XML data exchange, which is completely transparent between the Web service written by. NET and Visual FoxPro, and this invocation is possible across domain networks.

Part IV: Introduction to Visual FoxPro for. NET Toolkit

Our foothold here is how to apply the existing Visual FoxPro technology to the. NET platform, which seems to have little meaning for developers who do not have the background of Fox technology, but the next thing to introduce is the 100%. NET native resource, which is the Visual FoxPro For. NET Toolkit.

Visual FoxPro for. NET Toolkit, respectively, with VB. NET and C # are implemented once, is a native resource of. Net. Its namespace is: Vfptoolkit, which contains a total of 10 class definitions, containing 225 static functions altogether. These 10 class definitions are arrays, common, dates, dialogs, environment, files, help, Math, strings, vfpdata, and all of these functions are visual FoxPro In the corresponding function "clone". Because it's right. NET two packages, due to the Fox developers to consider the habit, so this tollkit is very practical, easy to use. For Fox developers, clearing them off is unfamiliar. NET, it is also a good resource for other developers.

In addition, the Toolkit is free, open source, and Microsoft's Fox team provides technical support. Anyway, this is a good thing, go download: http://www.gotdotnet.com/team/vfp/.

Summarize:

Here, basically complete the about "in." NET in the use of visual FoxPro resources "discussion. Next version 8 of Visual FoxPro will release the beta version in October, when we will see the new Fox will provide more and more direct support to. NET, of course it's something. All right, here we go!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.