Returning Objects

Discussion in 'ASP .Net Web Services' started by SS IT Services LLC, Dec 19, 2008.

  1. Is it a bad practice to return strong typed class objects from my
    webservice?

    If so, what is the preferred option.


    --
    Scott
    SS IT Services, LLC
    SS IT Services LLC, Dec 19, 2008
    #1
    1. Advertising

  2. "SS IT Services LLC" <> wrote in message
    news:...
    > Is it a bad practice to return strong typed class objects from my
    > webservice?
    >
    > If so, what is the preferred option.


    No. That's the preferred option, assuming you understand what it means.
    Although you will be _returning_ those types, you will not be _sending_
    them, and your clients will not be _receiving_ them.

    When you return any type, including a primitive type like string, you will
    be sending XML back to the client. In many cases, the client will
    deserialize this XML into an instance of some proxy type - a type that makes
    it easier for the client to access the deserialized XML. This will not be
    the same type you sent, so that type will not have any of the methods of
    your original type.

    Also, you should not return platform-specific types, as those types may well
    not exist on the platform being used by the client. In particular, do not
    return DataSet or DataTable.

    John
    John Saunders, Dec 21, 2008
    #2
    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. Vikas
    Replies:
    2
    Views:
    14,355
    Vikas
    Aug 27, 2003
  2. exquisitus
    Replies:
    6
    Views:
    6,589
    sanjay manohar
    Feb 22, 2005
  3. Scott
    Replies:
    4
    Views:
    355
    Scott
    Oct 12, 2003
  4. Replies:
    11
    Views:
    648
    Christos Georgiou
    May 2, 2006
  5. 7stud
    Replies:
    11
    Views:
    667
    Dennis Lee Bieber
    Mar 20, 2007
Loading...

Share This Page