Levan
Levan

Reputation: 21

datatable from webservice on .Net

When I expose a .NET System.Data.DataTable from a WebService, how to I access it from Delphi Win32?

Upvotes: 1

Views: 526

Answers (2)

Pascal
Pascal

Reputation: 2984

Levan, I don't know of any way to do so automatically. When the System.Data.DataTable is serialized to XML, it is done in a way that is not optimized to be imported natively by Delphi. What Bruce said is very true also; Delphi 7 WSDL is very buggy.
Whenever you have a Web Service that might be consumed by a language different then .Net, it's not a good practice to return internal .Net classes, since it won't be easy/simple to use them on a non .Net language. One possible solution (the one that I would choose) is to create a serializable DTO class (Data Transfer Object), which it's single purpose is to return the information you need. You transfer the data from the DataTable into that object, and send it over the wire. The Delphi 2007 WSDLImp.exe should handle it fine, and you'll be able to read the data more easily. If you do that a lot, you can even create a custom class to handle it.

Upvotes: 0

Bruce McGee
Bruce McGee

Reputation: 15334

Delphi 7 had problems with its support for consuming web services. I don't know if it has the support you need, but this is much better in Delphi 2007 and later.

The Delphi 2007 importer and runtime enhancements have been made available to D7-D2006 users. You'll need to use the command line WSDLImp.exe, though.

Upvotes: 1

Related Questions