U
UL-Tomten
I am consuming an ASP.NET Web Service which returns only DataSets for
all operations. The format/schema of the data returned by each method
is known and doesn't change. Untyped DataSets are inelegant to use on
the client when the data format is known, so I want typed data access
to each response type. Using a typed DataSet would be fine, but
anything that programmatically lets me access data is fine.
What is the "Visual Studio" (2005, 2008, doesn't matter) solution to
this? I have attempted to create typed DataSets from the Web Service
using every VS method I could think of, but I haven't gotten it to
work. Things I've tried include
1. xsd.exe /d using actual response XML: the generated .xsd file is
not usable as a typed DataSet as far as I can see.
2. xsd.exe /d using an XSD generated with WriteXmlSchema on the
DataSet returned by the Web Method: same as above.
3. "Create schema" in Visual Studio using actual response XML: I've
found no way to go from here to a typed DataSet.
My current solution is very old-school and relies on XmlSerializer to
deserialize the DataSet/DiffGram XML embedded in the DataSet returned
by the Web Method. This seems to me like a very un-Visual Studio
approach. The only working alternative I have so far is manually
creating typed DataSets, using the Visual Studio designer, to match
the response DataSets. Obviously, this too feels like a suboptimal
approach.
There are numerous references to "Generate DataSet" in the
documentation, but that command is always disabled, regardless of how
I create an XML schema. I'm assuming strict requirements are made on
the XML schema for this to work, but I can't find any information in
the documentation. Maybe it doesn't work the way I imagine it does.
I've also found many references to the drawbacks of using DataSets as
response types in Web Services, but there's nothing I can do about
that.
Any thoughts? All I want is early-bound, typed, programmatic access to
data in the DataSet.
all operations. The format/schema of the data returned by each method
is known and doesn't change. Untyped DataSets are inelegant to use on
the client when the data format is known, so I want typed data access
to each response type. Using a typed DataSet would be fine, but
anything that programmatically lets me access data is fine.
What is the "Visual Studio" (2005, 2008, doesn't matter) solution to
this? I have attempted to create typed DataSets from the Web Service
using every VS method I could think of, but I haven't gotten it to
work. Things I've tried include
1. xsd.exe /d using actual response XML: the generated .xsd file is
not usable as a typed DataSet as far as I can see.
2. xsd.exe /d using an XSD generated with WriteXmlSchema on the
DataSet returned by the Web Method: same as above.
3. "Create schema" in Visual Studio using actual response XML: I've
found no way to go from here to a typed DataSet.
My current solution is very old-school and relies on XmlSerializer to
deserialize the DataSet/DiffGram XML embedded in the DataSet returned
by the Web Method. This seems to me like a very un-Visual Studio
approach. The only working alternative I have so far is manually
creating typed DataSets, using the Visual Studio designer, to match
the response DataSets. Obviously, this too feels like a suboptimal
approach.
There are numerous references to "Generate DataSet" in the
documentation, but that command is always disabled, regardless of how
I create an XML schema. I'm assuming strict requirements are made on
the XML schema for this to work, but I can't find any information in
the documentation. Maybe it doesn't work the way I imagine it does.
I've also found many references to the drawbacks of using DataSets as
response types in Web Services, but there's nothing I can do about
that.
Any thoughts? All I want is early-bound, typed, programmatic access to
data in the DataSet.