Question about methodology for Gurus

Discussion in 'ASP .Net Web Services' started by JR, Dec 10, 2003.

  1. JR

    JR Guest

    Hi,

    I have a question about the best method to return sql records through a web
    service.

    I will potentially be sending back anywhere from one to a thousand records
    from a sql call through a webmethod. I would like some advice on the "Best"
    way to send the data to the client. Right now I am filling a dataset from
    the sql call, writing the xml to an xmlwriter object, then converting that
    to a string which I then return to the client.

    Would it be better to send back a collection or custom object or is there
    another approach that I'm missing? I would like to keep this as scalable as
    possible so I would like to avoid using datasets and such.


    Thanks in advance,
    Jamie
     
    JR, Dec 10, 2003
    #1
    1. Advertisements

  2. JR

    Jan Tielens Guest

    If you want to avoid a DataSet, I would recommend using custom objects in a
    collection. Ofcourse this will be somehow a performance degradation, like
    you have now when you serialize your DataSet to a string. Using custom
    objects you get the advantage that you are working with types, instead of a
    long string with xml in it. Ofcourse xml in string format is the most
    flexible solution, so it's always the choice between flexibility and
    ease-of-use.

    If your concern is interoperability (e.g. communication with java clients),
    the custom objects won't raise any issues. I've succesfully implemented such
    a solution without any problems regarding the communication between .NET and
    Java.

    --
    Greetz

    Jan Tielens
    ________________________________
    Read my weblog: http://weblogs.asp.net/jan


    "JR" <> wrote in message
    news:#G$...
    > Hi,
    >
    > I have a question about the best method to return sql records through a

    web
    > service.
    >
    > I will potentially be sending back anywhere from one to a thousand records
    > from a sql call through a webmethod. I would like some advice on the

    "Best"
    > way to send the data to the client. Right now I am filling a dataset from
    > the sql call, writing the xml to an xmlwriter object, then converting that
    > to a string which I then return to the client.
    >
    > Would it be better to send back a collection or custom object or is there
    > another approach that I'm missing? I would like to keep this as scalable

    as
    > possible so I would like to avoid using datasets and such.
    >
    >
    > Thanks in advance,
    > Jamie
    >
    >
     
    Jan Tielens, Dec 10, 2003
    #2
    1. Advertisements

  3. JR

    JR Guest

    Great info, thanks for the advise Jan.


    "Jan Tielens" <> wrote in message
    news:%...
    > If you want to avoid a DataSet, I would recommend using custom objects in

    a
    > collection. Ofcourse this will be somehow a performance degradation, like
    > you have now when you serialize your DataSet to a string. Using custom
    > objects you get the advantage that you are working with types, instead of

    a
    > long string with xml in it. Ofcourse xml in string format is the most
    > flexible solution, so it's always the choice between flexibility and
    > ease-of-use.
    >
    > If your concern is interoperability (e.g. communication with java

    clients),
    > the custom objects won't raise any issues. I've succesfully implemented

    such
    > a solution without any problems regarding the communication between .NET

    and
    > Java.
    >
    > --
    > Greetz
    >
    > Jan Tielens
    > ________________________________
    > Read my weblog: http://weblogs.asp.net/jan
    >
    >
    > "JR" <> wrote in message
    > news:#G$...
    > > Hi,
    > >
    > > I have a question about the best method to return sql records through a

    > web
    > > service.
    > >
    > > I will potentially be sending back anywhere from one to a thousand

    records
    > > from a sql call through a webmethod. I would like some advice on the

    > "Best"
    > > way to send the data to the client. Right now I am filling a dataset

    from
    > > the sql call, writing the xml to an xmlwriter object, then converting

    that
    > > to a string which I then return to the client.
    > >
    > > Would it be better to send back a collection or custom object or is

    there
    > > another approach that I'm missing? I would like to keep this as scalable

    > as
    > > possible so I would like to avoid using datasets and such.
    > >
    > >
    > > Thanks in advance,
    > > Jamie
    > >
    > >

    >
    >
     
    JR, Dec 10, 2003
    #3
  4. If you want the table metaphor, you can also do something like

    [WebMethod(Description="returns an XmlNode derived from a DataSet. This
    form excludes schema info. ")]
    public System.Xml.XmlNode GetDataSet_XmlDoc(int orderId) {
    System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
    System.Data.DataSet ds= Service(orderId);
    doc.LoadXml(ds.GetXml());
    return doc;
    }


    "JR" <> wrote in message
    news:...
    > Great info, thanks for the advise Jan.
    >
    >
    > "Jan Tielens" <> wrote in message
    > news:%...
    > > If you want to avoid a DataSet, I would recommend using custom objects

    in
    > a
    > > collection. Ofcourse this will be somehow a performance degradation,

    like
    > > you have now when you serialize your DataSet to a string. Using custom
    > > objects you get the advantage that you are working with types, instead

    of
    > a
    > > long string with xml in it. Ofcourse xml in string format is the most
    > > flexible solution, so it's always the choice between flexibility and
    > > ease-of-use.
    > >
    > > If your concern is interoperability (e.g. communication with java

    > clients),
    > > the custom objects won't raise any issues. I've succesfully implemented

    > such
    > > a solution without any problems regarding the communication between .NET

    > and
    > > Java.
    > >
    > > --
    > > Greetz
    > >
    > > Jan Tielens
    > > ________________________________
    > > Read my weblog: http://weblogs.asp.net/jan
    > >
    > >
    > > "JR" <> wrote in message
    > > news:#G$...
    > > > Hi,
    > > >
    > > > I have a question about the best method to return sql records through

    a
    > > web
    > > > service.
    > > >
    > > > I will potentially be sending back anywhere from one to a thousand

    > records
    > > > from a sql call through a webmethod. I would like some advice on the

    > > "Best"
    > > > way to send the data to the client. Right now I am filling a dataset

    > from
    > > > the sql call, writing the xml to an xmlwriter object, then converting

    > that
    > > > to a string which I then return to the client.
    > > >
    > > > Would it be better to send back a collection or custom object or is

    > there
    > > > another approach that I'm missing? I would like to keep this as

    scalable
    > > as
    > > > possible so I would like to avoid using datasets and such.
    > > >
    > > >
    > > > Thanks in advance,
    > > > Jamie
    > > >
    > > >

    > >
    > >

    >
    >
     
    Dino Chiesa [Microsoft], Dec 11, 2003
    #4
    1. Advertisements

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. Alex
    Replies:
    6
    Views:
    2,317
    John Saunders
    Aug 26, 2003
  2. Replies:
    3
    Views:
    553
    Clint Hill
    Jul 25, 2005
  3. George Copeland

    Question for Java Gurus

    George Copeland, May 17, 2004, in forum: Java
    Replies:
    44
    Views:
    1,488
    P.Hill
    May 25, 2004
  4. Dirk McCormick
    Replies:
    2
    Views:
    581
  5. Sean Berry
    Replies:
    5
    Views:
    428
    Cameron Laird
    Feb 27, 2004
  6. sonic_soul
    Replies:
    1
    Views:
    425
    David
    Oct 26, 2004
  7. Reg

    Interop question for WCF Gurus

    Reg, Aug 29, 2007, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    222
  8. Joe Cosby

    Regex gurus question

    Joe Cosby, Oct 7, 2004, in forum: Perl Misc
    Replies:
    8
    Views:
    205
    Shawn Corey
    Oct 7, 2004
Loading...