locked
Serialisation problem passing datatable as parameter to web method

    Question

  • Hi,

    I have developed web method that accepts an array of ints and a strongly typed datatable, which is also an out parameter. When i invoke a method from an aspx page the method works correctly and returns a datatable full of users as i would expect.

     

    My problem is that when i call the web service using Web Service Studio i get the following error as it tries to reflect proxy assembly:

     

    System.InvalidOperationException: The XML element named '' from namespace 'http://winterthur-life.co.uk/webservices/internal/GenericLogonSystem/' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the element.
       at System.Xml.Serialization.XmlReflectionImporter.AddUniqueAccessor(NameTable scope, Accessor accessor)
       at System.Xml.Serialization.XmlReflectionImporter.AddUniqueAccessor(MemberMapping member, NameTable elements, NameTable attributes)
       at System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns)

     

    If i replace the datatable with the strongly typed dataset that contains the datatable it seems to work fine. I have now replaced the datatable with the dataset but I would like to know why I am getting such a problem?

     

    Why would the problem only occur when i use Web Service Studio?

    Is it a problem related to Web Service Studio?

    Or is there an issue with passing datatables as parameters due to the serialisation process?

     

    Your thoughts would be much apprieciated.

    Andy.

     

     

    Friday, May 02, 2008 2:50 PM

Answers

  • This is almost certainly a problem in Web Service Studio since it's not a supported tool (I'm not even sure where to download it anymore).

     

    Generally if you have concerns about interoperability, you shouldn't pass DataSets/DataTables as parameters since they are .NET specific objects.

     

    Thanks.

    Friday, May 02, 2008 9:53 PM

All replies

  • This is almost certainly a problem in Web Service Studio since it's not a supported tool (I'm not even sure where to download it anymore).

     

    Generally if you have concerns about interoperability, you shouldn't pass DataSets/DataTables as parameters since they are .NET specific objects.

     

    Thanks.

    Friday, May 02, 2008 9:53 PM
  • Returning DataTables now works with WebServiceStudio v2.0.2 which can be downloaded here: http://www.codeplex.com/WebserviceStudio
    Thursday, June 19, 2008 10:08 PM