visual-studiowsdl.exe

Can Visual Studio 2005 wsdl.exe create proxy methods with generic parameters?


The proxy methods that I am seeing generated for methods that have generics for parameters like List Of <T> are getting converted to arrays in the proxy methods. I am not sure what the problem is, is it that the wsdl.exe that shipped with Visual Studio 2005 can't handle generics, or is it the version of soap on the machine where the web service is deployed or something else? When I view the asmx file in IE 7, I see SOAP 1.1 I expected to see soap 1.2 but that could be an IE7 thing.


Solution

  • WSDL.EXE and "Add Web Reference" will always use an array. This has nothing to do with generics.

    When you upgrade to WCF, you'll be able to specify to use List<T> for lists like this.


    XML Schema has neither arrays nor lists, just repeated elements. For instance, if your service returns List<int>, the XML Schema in the WSDL will be something like

    <xs:element name="result" maxOccurs="unbounded" type="xs:int"/>
    

    The program that creates the proxy class has to decide whether to translate this into arrays or lists. With "Add Web Reference", the choice is always "array". With "Add Service Reference", you get a number of choices, including List<int>.