I'm trying to dynamically serialize an object[] in SOAP format. The object[] can contain mixed types. Some of these types are well known like ints, longs, etc. The others are locally defined structs. When I attempt the serialization of a local struct, I get the following exception:
System.InvalidOperationException: The type MyStruct was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically. Fine, I need to get the MyStruct type into the serializer. The question is how when using code like the following: SoapReflectionImporter importer = new SoapReflectionImporter(); XmlTypeMapping mapping = importer.ImportTypeMapping( typeof( object[] ) ); XmlSerializer serializer = new XmlSerializer( mapping ); serializer.Serialize( xmlWriter, myStructs ); I can't see a way to get the SoapInclude attribute into the mix. Any help would be appreciated. Thanks, Jim You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.
