Alex,
Returning XML strings from WebServices is, IMHO, the best way to handle data ... I wouldn't change a thing about your current WS. And, you don't have to do anything special to consume the XML string in .NET. DataSets have methods to read XML strings already built into them. Try something like this:
public void FillWithXml(DataSet Data, string XML)
{
StringReader sr = new StringReader(XML);
Data.ReadXml(sr, XmlReadMode.InferSchema);
Data.AcceptChanges();
}
~~Bonnie
>I have a Web Service I created some time ago in VFP. I was always the only consumer so I made it return XML.
>
>Forward a year later. Somebody saw it and liked it. They now want to consume from ASP.NET and one guy said he'll like to use it from Excel (VBA+ADO classic). Basically they need it as it extracts contact and customer info from SQL Server and these guys don't have access to the data so the WS would fit in nicely.
>
>First things first, I figured I better learn myself how to consume it from .Net.
>I created a simple Winform (C#) and added a reference to the WSDL. I plugged in a value and XML was returned and displayed in a label on the form. So far so good.
>
>Now the questions start. I could learn how to read XML (easy enough from a book) and convert it into a DataSet so I could display in a grid (result could be anywhere from 1 to 300 records max).
>
>But this would be too complicated for our web guys who are just learning to move from ASP to ASP.NET, and more so for the Excel VBA guy who's not a developer but an Excel knowledgeable user. They would need simpler DataSet-ready data (I guess a simple ADO recordset would do).
>
>Before I immerse myself into changing the Web Services results from XML into something else, what would be the best way to return something from VFP 9.0 that is easily consumable from ADO (classic) and also ADO.NET?
>
>TIA
>
>[Update]: I'm thinking I'm going to rename the originals and duplicate them to return in different formats. For example (not real WS names but easier for illustration):
>
>GetCustomerNameFromCustID()
>
>could change to:
>
>GetCustomerNameFromCustID_XML()
>GetCustomerNameFromCustID_ADO()
>GetCustomerNameFromCustID_Whatever()
>