Yeah that was the first thing I tried but I keep getting ClassCastException
whenever I try to downcast an object from the list to either ObjectOne or
ObjectTwo.
I now also tried to use @XmlSeeAlso - had to put it in the service interface
so they would appear in my wsdl but it makes no difference
(@XmlSeeAlso(value = { ObjectOne.class, ObjectTwo.class })); still a
ClassCastException.
If I use List I also get an exception: java.lang.ClassCastException:
org.apache.xerces.dom.ElementNSImpl
Am I doing something wrong here?
Ronald
dkulp wrote:
>
> On Monday 01 December 2008 4:26:20 am Ronald Pieterse wrote:
>> In my webservice I would like to be able to accept a list of different
>> types of objects. So the client would send a list of different objects
>> and
>> the server would then be able to see which object is which.
>> I understand that JAXB does not handle interfaces. Is there maybe another
>> way to get this working if it is at all possible?
>
> JAXB doesn't really handle interfaces, but it does handle object
> heiarchies.
> If you have a "BaseObject" and ObjectOne and ObjectTwo both subclass it,
> a "List<BaseObject>" would work just fine. You may need to add some
> @XmlSeeAlso annotations to point at ObjectOne and ObjectTwo so the JAXB
> runtime will know about them, but that's relatively minor.
>
> Alternatively, you CAN just have "List" (which maps to a xsd:any) and
> use the XmlSeeAlso to point at ObjectOne and ObjectTwo and throw them in
> the
> list. JAXB can also handle that. It kind of depends on what you want
> the
> resulting schema to look like.
>
> Dan
>
>
>> To clearify, I imagine something like:
>>
>> <object-type-one>
>> <prop-one>...</prop-one>
>> </object-type-one>
>> <object-type-two>
>> <prop-two-one>...</prop-two-one>
>> <prop-two-two>...</prop-two-two>
>> </object-type-two>
>>
>> and then both objects would maybe extend or implement something. Probably
>> a
>> little vague but hope you understand what I mean :-)
>>
>> Greetz,
>>
>> Ronald
>
>
>
> --
> Daniel Kulp
> [EMAIL PROTECTED]
> http://dankulp.com/blog
>
>
--
View this message in context:
http://www.nabble.com/Different-object-types-in-list-tp20768640p20812667.html
Sent from the cxf-user mailing list archive at Nabble.com.