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. Advertising

  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. Advertising

  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. 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. imavroid
    Replies:
    0
    Views:
    839
    imavroid
    Mar 12, 2006
  2. Replies:
    3
    Views:
    437
    Clint Hill
    Jul 25, 2005
  3. Imran Aziz
    Replies:
    2
    Views:
    1,209
    Imran Aziz
    Aug 5, 2005
  4. Ted Holden

    CORBA or some other methodology?

    Ted Holden, Nov 18, 2004, in forum: Java
    Replies:
    12
    Views:
    596
    ted holden
    Nov 22, 2004
  5. arieljake
    Replies:
    3
    Views:
    338
    arieljake
    Feb 9, 2005
Loading...

Share This Page