Return Dataset?

Discussion in 'ASP .Net Web Services' started by Fao, Sean, May 25, 2005.

  1. Fao, Sean

    Fao, Sean Guest

    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,

    --
    Sean
     
    Fao, Sean, May 25, 2005
    #1
    1. Advertising

  2. Fao, Sean

    RichardF Guest

    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

    On Wed, 25 May 2005 12:40:37 -0400, "Fao, Sean"
    <-WANT-NO-SPAM> wrote:

    >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,
     
    RichardF, May 25, 2005
    #2
    1. Advertising

  3. Fao, Sean

    Fao, Sean Guest

    > On Wed, 25 May 2005 12:40:37 -0400, "Fao, Sean"
    > <-WANT-NO-SPAM> wrote:
    >>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?


    RichardF wrote:
    > 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.

    --
    Sean
     
    Fao, Sean, May 26, 2005
    #3
  4. Fao, Sean

    Fao, Sean Guest

    Fao, Sean, May 26, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nedu N
    Replies:
    1
    Views:
    1,818
    Chris Taylor
    Oct 31, 2003
  2. JimO

    DataSet and dataSet

    JimO, Mar 1, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    533
    Mary Chipman [MSFT]
    Mar 8, 2006
  3. Joseph D. DeJohn

    DataSet to DataSet

    Joseph D. DeJohn, Aug 4, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    406
  4. Nedu N
    Replies:
    2
    Views:
    2,172
  5. Greenhorn
    Replies:
    15
    Views:
    845
    Keith Thompson
    Mar 6, 2005
Loading...

Share This Page