error using arraylist as webmethod argument

Discussion in 'ASP .Net Web Services' started by Steven, Feb 12, 2006.

  1. Steven

    Steven Guest

    I'm having trouble using an arraylist of a custom object as an argument in a
    webservice, everything is in VB.Net. Visual Studio

    I can pass the custom object as an argument to other webmethods fine, and
    can return it fine. I can have the webservice return an arraylist of the
    objects and consume them with no dramas.

    But whenever I call the method it gives this error, failing on the call,
    before it actually goes 'into' the function.
    "The type websync.Record was not expected. Use the XmlInclude or SoapInclude
    attribute to specify types that are not known statically."

    the WebMethod I'm calling looks like:
    Public Function getUpdateRecords(ByVal type As String, ByVal records As
    ArrayList) As ArrayList

    The record looks like:
    Public Class Record
    Public id As New Integer
    Public values As New ArrayList
    End Class

    This is part of the stack trace shown:
    [InvalidOperationException: The type websync.Record was not expected. Use
    the XmlInclude or SoapInclude attribute to specify types that are not known
    statically.]
    System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive(String
    name, String ns, Object o, Boolean xsiType)
    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_Object(String
    n, String ns, Object o, Boolean isNullable, Boolean needType)
    Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write3_getUpdateRecords(Object[]
    p)

    Any help? I couldn't find any decent information on how to use
    XMLinclude/SoapInclude that helped.
     
    Steven, Feb 12, 2006
    #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. Saravanan Rathinavelu

    Iterate through ArrayList using an another ArrayList

    Saravanan Rathinavelu, Aug 16, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    2,772
    Natty Gur
    Aug 19, 2003
  2. Kaidi
    Replies:
    4
    Views:
    2,432
    Kaidi
    Jan 3, 2004
  3. xz
    Replies:
    16
    Views:
    2,409
  4. Alex

    Returning ArrayList from WebMethod, best practices

    Alex, Jul 16, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    122
  5. Returning an ArrayList from a WebMethod()

    , Jan 3, 2006, in forum: ASP .Net Web Services
    Replies:
    4
    Views:
    185
    Javier G. Lozano
    Jan 17, 2006
Loading...

Share This Page