I suspect I am being very silly here but I have the following setup
Class MustInherit myBaseClass
'some stuff
End Class
Class myInheritedClassA
inherits myBaseClass
'some more stuff
End Class
Class myInheritedClassB
inherits myBaseClass
'some more stuff
End Class
I then have a web service that has a method
Function getSomeClass(id) as myBaseClass
'a factory here dependent on the id will generate a myInherited Class
return CType(aInstanceOfInheritedClass, mybaseClass)
End function
Running this results in the following error
Unhandled Exception: System.InvalidOperationException:
There was an error generating the XML document. --->
System.InvalidOperationException:
The type <type> was not expected.
Use the XmlInclude or SoapInclude attribute to specify types
that are not known statically."
So my question is, is there any way of 'Widening' the inherited class to the base class so this would work?
EDIT: RE: the suggestion regarding XmlInclude(typeof inheritedClass), currently this method could potentially return a number of types of inherited class (i.e myInheritedClassA and myInheritedClassB) is it case of simply having to add each of the inheritedTypes in this tag?
I have amended the example to hopefully make things clearer