You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Lee Theobald <le...@openobjects.com> on 2013/03/08 12:57:14 UTC
JAW-WS & Returning Subclasses
HI all,
I'm trying to get a JAX-WS service (with Aegis as the data binding)
working as I want but I'm falling at the last hurdle. I've got a method
defined as follows:
public Field getField(String sourceName, String fieldName) throws
FieldNotFoundException;
Field is an interface. Currently I have an implementation of FieldImpl
that returns fine via the service. The trouble is that I want to return
fields that extend FieldImpl. So for example, I have the below type
hierarchy:
Field
FieldImpl
MediaFieldImpl
TypeFieldImpl
RelatedFieldImpl
I'd like to return media, type & related fields but when I attempt to
return MediaFieldImpl via getField, I only get back the parts of
MediaFieldImpl that conform to the Field interface (so none of the extra
fields defined in MediaFieldImpl). I've been trying a variety of
different things (@XmlSeeAlso, @XmlRootElement & various different
annotations in places) to get this working but having no luck. Best
I've got so far is the MediaFieldImpl, TypeFieldImpl etc. classes
appearing in the WSDL via a dummy method as suggested in an IBM article
<http://www.ibm.com/developerworks/websphere/techjournal/0401_brown/brown.html>.
But I still can't get the correct type of Field returned from my method.
Does anyone have any suggestions on what else I can try or if I'm
barking up the wrong tree? This is using an old version of CXF (2.2)
and I'm letting CXF generate the WSDL for me. I realise I might have
more luck if I take a more top-down approach & write the WSDL myself but
as this is an existing web service I'm trying to extend, I'd rather not
rock the boat too much if I don't have to.
Cheers for any input,
Lee
Re: JAW-WS & Returning Subclasses
Posted by Lee Theobald <le...@openobjects.com>.
Cheers for the input Dan. At least I know to concentrate my efforts on
non-Aegis routes now. I only started with Aegis as is what we've always
used (and have done since the days of XFire). It certainly would be
wise to take another look at JAXB to see how it compares nowadays.
Lee,
Daniel Kulp wrote:
> Honestly, I don't think there is a way to currently do this with Aegis. Aegis currently doesn't have any concept of an XmlSeeAlso annotation or similar to be able to set additional classes to add into the Aegis context. You MAY be able to programatically create an AegisContext object and configure in some "root" types to add additional class, but I'm not really sure how that would all work.
>
> Dan
>
>
>
> On Mar 8, 2013, at 6:57 AM, Lee Theobald<Le...@openobjects.com> wrote:
>
>> HI all,
>>
>> I'm trying to get a JAX-WS service (with Aegis as the data binding) working as I want but I'm falling at the last hurdle. I've got a method defined as follows:
>>
>> public Field getField(String sourceName, String fieldName) throws FieldNotFoundException;
>>
>> Field is an interface. Currently I have an implementation of FieldImpl that returns fine via the service. The trouble is that I want to return fields that extend FieldImpl. So for example, I have the below type hierarchy:
>>
>> Field
>> FieldImpl
>> MediaFieldImpl
>> TypeFieldImpl
>> RelatedFieldImpl
>>
>> I'd like to return media, type& related fields but when I attempt to return MediaFieldImpl via getField, I only get back the parts of MediaFieldImpl that conform to the Field interface (so none of the extra fields defined in MediaFieldImpl). I've been trying a variety of different things (@XmlSeeAlso, @XmlRootElement& various different annotations in places) to get this working but having no luck. Best I've got so far is the MediaFieldImpl, TypeFieldImpl etc. classes appearing in the WSDL via a dummy method as suggested in an IBM article<http://www.ibm.com/developerworks/websphere/techjournal/0401_brown/brown.html>. But I still can't get the correct type of Field returned from my method.
>>
>> Does anyone have any suggestions on what else I can try or if I'm barking up the wrong tree? This is using an old version of CXF (2.2) and I'm letting CXF generate the WSDL for me. I realise I might have more luck if I take a more top-down approach& write the WSDL myself but as this is an existing web service I'm trying to extend, I'd rather not rock the boat too much if I don't have to.
>>
>> Cheers for any input,
>> Lee
>
Re: JAW-WS & Returning Subclasses
Posted by Daniel Kulp <dk...@apache.org>.
Honestly, I don't think there is a way to currently do this with Aegis. Aegis currently doesn't have any concept of an XmlSeeAlso annotation or similar to be able to set additional classes to add into the Aegis context. You MAY be able to programatically create an AegisContext object and configure in some "root" types to add additional class, but I'm not really sure how that would all work.
Dan
On Mar 8, 2013, at 6:57 AM, Lee Theobald <Le...@openobjects.com> wrote:
> HI all,
>
> I'm trying to get a JAX-WS service (with Aegis as the data binding) working as I want but I'm falling at the last hurdle. I've got a method defined as follows:
>
> public Field getField(String sourceName, String fieldName) throws FieldNotFoundException;
>
> Field is an interface. Currently I have an implementation of FieldImpl that returns fine via the service. The trouble is that I want to return fields that extend FieldImpl. So for example, I have the below type hierarchy:
>
> Field
> FieldImpl
> MediaFieldImpl
> TypeFieldImpl
> RelatedFieldImpl
>
> I'd like to return media, type & related fields but when I attempt to return MediaFieldImpl via getField, I only get back the parts of MediaFieldImpl that conform to the Field interface (so none of the extra fields defined in MediaFieldImpl). I've been trying a variety of different things (@XmlSeeAlso, @XmlRootElement & various different annotations in places) to get this working but having no luck. Best I've got so far is the MediaFieldImpl, TypeFieldImpl etc. classes appearing in the WSDL via a dummy method as suggested in an IBM article <http://www.ibm.com/developerworks/websphere/techjournal/0401_brown/brown.html>. But I still can't get the correct type of Field returned from my method.
>
> Does anyone have any suggestions on what else I can try or if I'm barking up the wrong tree? This is using an old version of CXF (2.2) and I'm letting CXF generate the WSDL for me. I realise I might have more luck if I take a more top-down approach & write the WSDL myself but as this is an existing web service I'm trying to extend, I'd rather not rock the boat too much if I don't have to.
>
> Cheers for any input,
> Lee
--
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com