Return Dataset?

F

Fao, Sean

I'm relatively new to web services and I was wondering why, when authors
create a web service that queries a database, that they don't just
return the dataset object in the exposed method as in the following
fragment:

[WebMethod]
public System.Data.DataSet someQuery(string queryString)
{
[...]

return dataset;
}

What I usually see is that authors return a class, which describes the
structure of the results (like a table definition).

Is this just per convention or is there another explanation?

Thank you in advance,
 
R

RichardF

One explanation I can think of is that the DataSet is unique to .NET.

What if the user of your web service is not a .NET program?

If you want your web service to be easily used by non .NET users, then
you should avoid returning .NET specific objects. They could write
code to parse the XML representaiton of the DataSet, but simpler
return types might be more appropriate.

RichardF
 
F

Fao, Sean

I'm relatively new to web services and I was wondering why, when authors
create a web service that queries a database, that they don't just
return the dataset object in the exposed method as in the following
fragment:

[WebMethod]
public System.Data.DataSet someQuery(string queryString)
{
[...]

return dataset;
}

What I usually see is that authors return a class, which describes the
structure of the results (like a table definition).

Is this just per convention or is there another explanation?
[/QUOTE]
One explanation I can think of is that the DataSet is unique to .NET.

What if the user of your web service is not a .NET program?

If you want your web service to be easily used by non .NET users, then
you should avoid returning .NET specific objects. They could write
code to parse the XML representation of the DataSet, but simpler
return types might be more appropriate.

Doesn't the WSDL describe the data type? I thought that was one of the
ideas behind SOAP. That way, you can create your own data types and
everybody knows what they are.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top