Consuming Web services through Delphi
Evolution of the web industry leads developers through sophisticated technologies waving and balancing between client-oriented and server-oriented approaches. New standards for browsers, protocols, and scripting languages replace each other. The next step is XML - extended markup language, which suppose to replace HTML and dominate in web applications as main communication format. XML has been designed to transfer data to clients separately from data's format. Web server or Internet client should combine XML data with a style sheet and generate well-known HTML code to display the data.
On the other hand you may use XML language to extend functionality of your programs. Consider XML as a universal data storage format, which as a matter of fact much more flexible than DBF or any other relational database format.
Why should you use XML as the only advanced way to create web pages? XML is more universal and more flexible than just only markup language. You may even create your own data format or network protocol by inventing your own tags and interface.
Below you will find one example of such non-standard XML usage, designed for use in Borland Delphi applications.
Analysis:
Your program needs to store some data in a file or transfer the data to another computer. You can save your data in text or any proprietary format. You will need to write code to support such format. Should you change data structure, you will face necessity to modify the code. In any case you should not consider this format as a standard one, and other developers probably will not support the format.
Use XML as base for your data storage and transfer and you will gain the following advantages:
1. Established and supported syntax standards;
2. Common program interface for reading and writing XML text;
3. Flexible data structure;
4. Web enabled technology;
The most optimal and convenient way to implement this protocol in Delphi is to design an interface between Pascal objects and XML code. The goal is to store instances of Pascal classes in XML format with ability to restore the instances from the XML text.
It is a good idea to split "Pascal Object - XML" interface into two interfaces: "Pascal Object - Data object" and "Data object - XML" (see figure 1).
I do not see a dainty solution to extend any Pascal class with XML interface. Instead, let's create a new class to store and manage properties and data fields of an object. A developer will need to write additional code to move data between Pascal object and data object.
Data transaction in XML format is more useful in banking domain. Our developer’s implemented payment process to bank using web services (CommIdea icp version2) in Windows application called TMS (Telemarketing Software Systems).
At CAT, Borland Delphi is the most preferred tool for development work. Developers at CAT have worked on all versions of Delphi starting from version 3 to Delphi 7. Delphi adds flexibility, speed and eminence to application development. It is a highly productive Rapid Application Development tool.
Posted by: Anil Choudary