C
Christopher Ambler
This is one of those "what's my best way to do this?" questions...
I've written a shell for an ASP.NET web service. This service takes in a
single string and makes a database call to get information. The information
comes back as a whole slew of data. Numerous recordsets with a variable
number of rows each, a number of individual data items sent back as output
parameters to stored procedures... the works.
What I need to do is package up all of this information into XML, in a
format that I get to define. This chunk of XML will be sent back out from
the web service. Consumers of the web service will then use the XML to do
what they wish with it. Some will use the data to populate windows forms,
some will apply XSLT to it for very simple formatted text output, and the
like.
The web service is very simple - takes in a string and returns a string (the
return string being the XML blob). I presume that this is the easiest and
most robust way to expose this, right?
So my first thought was to take the database output and build an XMLDocument
from scratch as I go along. I do not have the luxury of getting the database
to give me my results in XML, so that's out of the question. Building the
XMLDocument and populating it is pretty easy, but tedious.
But then I wondered - is it possible to take the recordsets that I get back
and have them serialize to an XML format of my choosing? Would this be any
easier?
Or am I overlooking an obvious solution?
Many thanks in advance!
Christopher
(e-mail address removed)
I've written a shell for an ASP.NET web service. This service takes in a
single string and makes a database call to get information. The information
comes back as a whole slew of data. Numerous recordsets with a variable
number of rows each, a number of individual data items sent back as output
parameters to stored procedures... the works.
What I need to do is package up all of this information into XML, in a
format that I get to define. This chunk of XML will be sent back out from
the web service. Consumers of the web service will then use the XML to do
what they wish with it. Some will use the data to populate windows forms,
some will apply XSLT to it for very simple formatted text output, and the
like.
The web service is very simple - takes in a string and returns a string (the
return string being the XML blob). I presume that this is the easiest and
most robust way to expose this, right?
So my first thought was to take the database output and build an XMLDocument
from scratch as I go along. I do not have the luxury of getting the database
to give me my results in XML, so that's out of the question. Building the
XMLDocument and populating it is pretty easy, but tedious.
But then I wondered - is it possible to take the recordsets that I get back
and have them serialize to an XML format of my choosing? Would this be any
easier?
Or am I overlooking an obvious solution?
Many thanks in advance!
Christopher
(e-mail address removed)