Long String

Discussion in 'MCSD' started by Ken, Feb 22, 2004.

  1. Ken

    Ken Guest

    Hi

    I'm sending a long string to a web service like this:

    field1,field2,field3,field4,field5,field6,field7+field1,fie
    ld2,field3,field4,field5,field6,field7...

    On the web service I need to read and to parse it in order
    to fill a DataSet and to update the DB,so do I have to use
    the String class' methods inside a Do-While or there is a
    more powerfull way to do it?

    Thks
     
    Ken, Feb 22, 2004
    #1
    1. Advertising

  2. Would it not be better to format and send the information as an xml
    document?

    On Sat, 21 Feb 2004 19:48:38 -0800, "Ken"
    <> wrote:

    >Hi
    >
    >I'm sending a long string to a web service like this:
    >
    >field1,field2,field3,field4,field5,field6,field7+field1,fie
    >ld2,field3,field4,field5,field6,field7...
    >
    >On the web service I need to read and to parse it in order
    >to fill a DataSet and to update the DB,so do I have to use
    >the String class' methods inside a Do-While or there is a
    >more powerfull way to do it?
    >
    >Thks



    Kline Sphere (Chalk) MCNGP #3
     
    The Poster Formerly Known as Kline Sphere, Feb 22, 2004
    #2
    1. Advertising

  3. Ken

    Jay Walters Guest

    If you're building this web service to be used only
    by .NET applications, then I might use a DataSet
    (slightly easier to use but more overhead).

    Otherwise Kline is right, the best way is to use an XML
    Document.

    (staying with a delimited string), you could code
    something like:

    string[] fields = inputLongString.Split(new char{} {','});
    foreach (string s in fields)
    {
    //now your fields are available
    //but only the developer knows which
    //strings map to which fields
    //this is very hard to maintain or
    //add changes to later.
    }

    Additionally using a delimiter on database data is very
    bad. What if your data had commas? Are you going to code
    every app that uses the web service to not allow the end
    user of the app to enter commas? Now you're creating more
    work for yourself.

    You could pass a string[] in to your web method instead
    of a long string to avoid the delimiter problem.

    But you would still have the usability and
    maintainability problem... which array element is what?
    it's based on hidden logic. What if you want to add a
    field later? .. with an XmlDoc you code read the data
    based on element or attribute values. Very clear, very
    flexible, and less work in the long run.

    ~ Jay



    >-----Original Message-----
    >Hi
    >
    >I'm sending a long string to a web service like this:
    >
    >field1,field2,field3,field4,field5,field6,field7+field1,f

    ie
    >ld2,field3,field4,field5,field6,field7...
    >
    >On the web service I need to read and to parse it in

    order
    >to fill a DataSet and to update the DB,so do I have to

    use
    >the String class' methods inside a Do-While or there is

    a
    >more powerfull way to do it?
    >
    >Thks
    >.
    >
     
    Jay Walters, Feb 22, 2004
    #3
  4. Ken

    Ken Guest

    I need to send the smallest data possible cause I'm paying
    for each KB sent. I dont know if Datasets, arrays, classes
    increase the size of the data (if you know please let me
    know) but XML does.
    So far pure string is the smallest format I have found to
    send my info.



    >-----Original Message-----
    >Would it not be better to format and send the information

    as an xml
    >document?
    >
    >On Sat, 21 Feb 2004 19:48:38 -0800, "Ken"
    ><> wrote:
    >
    >>Hi
    >>
    >>I'm sending a long string to a web service like this:
    >>
    >>field1,field2,field3,field4,field5,field6,field7+field1,f

    ie
    >>ld2,field3,field4,field5,field6,field7...
    >>
    >>On the web service I need to read and to parse it in

    order
    >>to fill a DataSet and to update the DB,so do I have to

    use
    >>the String class' methods inside a Do-While or there is

    a
    >>more powerfull way to do it?
    >>
    >>Thks

    >
    >
    >Kline Sphere (Chalk) MCNGP #3
    >.
    >
     
    Ken, Feb 22, 2004
    #4
  5. Ken

    Jay Walters Guest

    Ok, you've got a special requirement.

    A delimited string is the smallest data you can probably
    send. But I would still consider using a string[].. to
    avoid the problems I mentioned with commas.

    If you're using a standard Web Service, the everything is
    XML anyways (a SOAP Message). Using a string array will
    add a little more space. Each element will be padded with
    reference tag... But, this extra padding would be tiny in
    comparison. We're talking about an extra 100 bytes or so.

    ~ Jay

    >-----Original Message-----
    >I need to send the smallest data possible cause I'm

    paying
    >for each KB sent. I dont know if Datasets, arrays,

    classes
    >increase the size of the data (if you know please let me
    >know) but XML does.
    >So far pure string is the smallest format I have found

    to
    >send my info.
    >
    >
    >
    >>-----Original Message-----
    >>Would it not be better to format and send the

    information
    >as an xml
    >>document?
    >>
    >>On Sat, 21 Feb 2004 19:48:38 -0800, "Ken"
    >><> wrote:
    >>
    >>>Hi
    >>>
    >>>I'm sending a long string to a web service like this:
    >>>
    >>>field1,field2,field3,field4,field5,field6,field7+field1

    ,f
    >ie
    >>>ld2,field3,field4,field5,field6,field7...
    >>>
    >>>On the web service I need to read and to parse it in

    >order
    >>>to fill a DataSet and to update the DB,so do I have to

    >use
    >>>the String class' methods inside a Do-While or there

    is
    >a
    >>>more powerfull way to do it?
    >>>
    >>>Thks

    >>
    >>
    >>Kline Sphere (Chalk) MCNGP #3
    >>.
    >>

    >.
    >
     
    Jay Walters, Feb 22, 2004
    #5
  6. >I need to send the smallest data possible cause I'm paying
    >for each KB sent.


    Find that hard to believe.

    Anyway, if that is the case then you would need to avoid using a 'web
    service' or for that matter anything to do with http as these would
    increase the size being transmitted! You're left with the option of
    using a compressed socket based solution to compress and send/receive
    the data.

    Kline Sphere (Chalk) MCNGP #3
     
    The Poster Formerly Known as Kline Sphere, Feb 22, 2004
    #6
    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. Mark C

    how long is too long?

    Mark C, Jul 23, 2003, in forum: Digital Photography
    Replies:
    12
    Views:
    773
  2. Mark C

    UPDATE (was: How long is too long)

    Mark C, Jul 28, 2003, in forum: Digital Photography
    Replies:
    0
    Views:
    386
    Mark C
    Jul 28, 2003
  3. Netflix: how long is long?

    , Nov 14, 2005, in forum: DVD Video
    Replies:
    25
    Views:
    1,331
    so57th
    Nov 18, 2005
  4. newasp.net
    Replies:
    1
    Views:
    1,668
    imransyed63
    Aug 21, 2008
  5. Ken

    Long String

    Ken, Feb 22, 2004, in forum: MCAD
    Replies:
    0
    Views:
    381
Loading...

Share This Page