XmlReturnReader in 2.0 does not support custom types?

Discussion in 'ASP .Net Web Services' started by AndyMalakov, Nov 29, 2005.

  1. AndyMalakov

    AndyMalakov Guest

    Hello All,

    I noticed that System.Web.Services.Protocols.XmlReturnReader in .NET
    Framework 2.0 (v2.0.50727) no longer capable of de-serializing custom
    data types. This is vital capability for non-SOAP based web services
    (REST, etc).

    It appears that now set of supported types is limited to types
    supported by System.Web.Services.Protocols.ScalarFormatter (such as:
    int, long, double, string, and few other predefined types).

    This new feature results in internal exception on attempt to use web
    service with method returning custom type:

    [HttpMethodAttribute(typeof(XmlReturnReader), ...)]
    public MyCustomResult foo (...) { ... }

    Here is the exception stack trace:

    System.IndexOutOfRangeException: Index was outside the bounds of the
    array.
    at System.Web.Services.Protocols.HttpClientType..ctor(Type type)
    at System.Web.Services.Protocols.HttpSimpleClientProtocol..ctor()
    at System.Web.Services.Protocols.HttpPostClientProtocol..ctor()
    at MyNS.MyServiceClient..ctor()

    The same code worked fine with version 1.1.

    There is a workarond - Extend XmlReturnReader and override
    GetInitializers() method to return XmlSerializer according to resulting
    type.

    P.S. God bless Lutz Roeder and his .NET Reflector :)

    All the Best,
    Andy
    AndyMalakov, Nov 29, 2005
    #1
    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. Sathyaish
    Replies:
    2
    Views:
    587
    Sathyaish
    May 22, 2005
  2. Soren Kuula
    Replies:
    2
    Views:
    561
    Henry S. Thompson
    Dec 1, 2005
  3. Jeremy Cowles

    STD types vs C++ intrinsic types

    Jeremy Cowles, Aug 18, 2003, in forum: C++
    Replies:
    5
    Views:
    1,883
    Bob Jacobs
    Aug 19, 2003
  4. Matt
    Replies:
    40
    Views:
    1,808
    Ioannis Vranos
    Apr 21, 2004
  5. Steve Knight
    Replies:
    2
    Views:
    754
    Steve Knight
    Oct 10, 2003
Loading...

Share This Page