Thanks Sergey.  It was right under my nose, but I didn't see it.

This got me around one problem, but now I'm faced with another in trying to
serialize an object[] of MyStruct.  Here's the exception message:

"Token StartElement in state Epilog would result in an invalid XML
document."

Serialization of this array works fine using XmlReflectionImporter but not
the SoapReflectionImporter.

Again, any ideas would be appreciated.

Jim

> -----Original Message-----
> From: Kats, Sergey [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 23, 2003 11:09 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [ADVANCED-DOTNET] Dynamic SOAP XML serialization
> problem...
>
>
> I don't know how to add SoapIncludeAttribute in this case but
> the following will work:
>
> importer.IncludeType(typeof(MyStruct));
>
> Sergey
>
> -----Original Message-----
> From: Sievert, James A [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 23, 2003 11:00 AM
> To: [EMAIL PROTECTED]
> Subject: Dynamic SOAP XML serialization problem...
>
>
> 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.
>
> You can read messages from the Advanced DOTNET archive,
> unsubscribe from Advanced DOTNET, or subscribe to other
> DevelopMentor lists at http://discuss.develop.com.
>

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to