By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,723 Members | 1,304 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,723 IT Pros & Developers. It's quick & easy.

error using arraylist as webmethod argument

P: n/a
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.Wr iteTypedPrimitive(String
name, String ns, Object o, Boolean xsiType)
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationWriter1.Write1_Object(String
n, String ns, Object o, Boolean isNullable, Boolean needType)
Microsoft.Xml.Serialization.GeneratedAssembly.XmlS erializationWriter1.Write3_getUpdateRecords(Object[]
p)

Any help? I couldn't find any decent information on how to use
XMLinclude/SoapInclude that helped.

Feb 12 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.