NAV webservice - publish table references as generic list

andrewtandrewt Member Posts: 73
edited 2015-09-24 in NAV Three Tier
Hi all,
In NAV 2015, I've created some NAV web services (SOAP, Page and XMLPorts through Codeunits) and recognized the NAV table references are always published as type System.Array when consuming the NAV webservice in Visual Studio. This remains even if I change the collection type of the Service Reference in Visual Studio to System.Collections.Generic.List.
As it would make things easier in Visual Studio to handle data as generic lists, I am wondering if there's a way to force the NAV web service to publish any table references as generic lists instead of arrays.
Does anybody know if this is possible and how to achieve this ?

Thanks in advance
AndrewT

Comments

  • kauffmannkauffmann Member Posts: 56
    It seems that you are not the only one in the world who experiences this behavior: setting the collection type of the service reference to Generic List does not have any effect.

    As far as I can see, the reason is because of the wsdl of the web service. The xsd schema in the wsdl specifies a strong type instead of xsd:anyType. It is not possible to influence this xsd schema.

    So the only way to consume a function like ReadMultiple is to use either Type[] or IList<Type> as the return type.
    A good programmer makes al the right mistakes
    My blog
Sign In or Register to comment.