wcf and returning a datatable

Discussion in 'ASP .Net Web Services' started by dave, Nov 19, 2007.

  1. dave

    dave Guest

    i have a working wcf service and am having problems returning a datatable
    from the wcf service.
    I am able to return properties and collections of objects however when
    returning a datatable i am getting a returned type of
    'CheckListResponseCheckListResult' (where checklist is the name of the
    function that returns the datatable)

    testing code below
    Dim stmp As WF374WCF.CheckListResponseCheckListResult =
    svc.CheckList(97)
    Console.WriteLine(stmp.Any)

    stmp.any is an xmlelement (which appears to have the schema information but
    i have yet to find the data (rows) within the return object.

    How do i get the datatable rehydrated on the client site?

    thank you
    dave
    dave, Nov 19, 2007
    #1
    1. Advertising

  2. dave

    Tiago Halm Guest

    A datatable is serialized via .NET Serialization, and you're building a
    WebService where the standard serialization (optimized for SOAP
    interoperability scenarios) is used. The standard serialization applies to
    simple types or complex types decorated with DataContract attribute.
    DataTable is not a simple type.

    The datatable serialization is not universal, is only .NET specific. You
    would be better off creating a DataContract with the expected struct the
    DataTable contains and return a List<MyStruct>.

    Tiago Halm

    "dave" <> wrote in message
    news:...
    >i have a working wcf service and am having problems returning a datatable
    > from the wcf service.
    > I am able to return properties and collections of objects however when
    > returning a datatable i am getting a returned type of
    > 'CheckListResponseCheckListResult' (where checklist is the name of the
    > function that returns the datatable)
    >
    > testing code below
    > Dim stmp As WF374WCF.CheckListResponseCheckListResult =
    > svc.CheckList(97)
    > Console.WriteLine(stmp.Any)
    >
    > stmp.any is an xmlelement (which appears to have the schema information
    > but
    > i have yet to find the data (rows) within the return object.
    >
    > How do i get the datatable rehydrated on the client site?
    >
    > thank you
    > dave
    >
    >
    >
    >
    Tiago Halm, Dec 6, 2007
    #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. J. Babe
    Replies:
    1
    Views:
    8,317
    Kevin Spencer
    Aug 15, 2003
  2. Fredrik Rodin

    Sort a datatable and create a new datatable

    Fredrik Rodin, Feb 16, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    9,029
    paul.mariotti
    Sep 28, 2007
  3. =?Utf-8?B?Qmx1ZWZsb3dlcg==?=

    Casting DataTable to class inherit from DataTable

    =?Utf-8?B?Qmx1ZWZsb3dlcg==?=, Apr 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    987
    =?Utf-8?B?Qmx1ZWZsb3dlcg==?=
    Apr 2, 2004
  4. Simon
    Replies:
    0
    Views:
    993
    Simon
    Oct 13, 2009
  5. Cindy Lee
    Replies:
    1
    Views:
    2,067
    Mr. Arnold
    Mar 19, 2010
Loading...

Share This Page