Returning a Generic from a web service

Discussion in 'ASP .Net Web Services' started by Alexander Walker, Feb 3, 2006.

  1. Hello

    I have a web method that returns a List<T>

    I have noticed that the proxy class generated with wsdl.exe does not return a
    type of List<T> but instead it returns a type of T[] is there some way I can get
    wsdl.exe or the Visual Studio IDE to generate a proxy class that will return a
    List<T>?

    I understand that I can edit the class generated by wsdl.exe myself but I would
    prefer not to do this as I would have to edit the file every time I regenerated
    the proxy

    Thanks

    Alex
    Alexander Walker, Feb 3, 2006
    #1
    1. Advertising

  2. Hi Alex,

    Welcome to the MSDN newsgroup.

    As for the generating client proxy for ASP.NET webservice that contains
    generic types parameters/return value problem you mentioned, this is an
    expected behavior due to XML webservice's nature.

    Basically, webservice only publish the WSDL document as the service
    contract to client users. And client users (some webservice toolkit or
    component) will generate the proxy code from the WSDL document. However,
    because WSDL document is based standard XML schema, no matter what
    platform specific types we haved used in webservice code, the WSDL document
    will use standard xml schema types to represent them. And for .net
    framework, such types like List, ArrayList, Collection will be represented
    by xml array. Also, using such standard xml schema types can help
    different client platform able to generate the correct proxy types to map
    the webservcie parameters/return values.

    Therefore, for your scenario, your webservice client is also using .net
    framework and you want to have the client proxy also use the .net specific
    types (the same as serverside service code), you have to manually modify
    the generated proxy code.

    Please feel free to let me know what you think.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    Steven Cheng[MSFT], Feb 6, 2006
    #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. Pablo Gutierrez
    Replies:
    0
    Views:
    330
    Pablo Gutierrez
    Oct 27, 2003
  2. Murat Tasan
    Replies:
    1
    Views:
    8,030
    Chaitanya
    Feb 3, 2009
  3. Replies:
    2
    Views:
    426
  4. minlearn
    Replies:
    2
    Views:
    445
    red floyd
    Mar 13, 2009
  5. Leo Violette
    Replies:
    0
    Views:
    1,005
    Leo Violette
    Apr 17, 2009
Loading...

Share This Page