You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Jean-Baptiste Onofré <jb...@nanthrax.net> on 2009/01/21 11:53:04 UTC
WSDL complexType and Abstract classes
Hi all,
I use a HTTP SU with a CXF-SE SU.
In the WSDL, I have ValueObject as complexType. The WSDL looks good.
If the complexType is a POJO class, there is no problem, it works fine.
But, in one WebService, I have a abstract class as complexType. I would like to
use the class that extend the super one transparently.
Is it possible to use a abstract class as operation argument ?
Is there any special annotate in the CXF-SE POJO to do it ?
Thanks,
Regards
JB
--
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086
Re: WSDL complexType and Abstract classes
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Well Freeman,
The Jira mainly shows how to extend the JAXB context. I already use it with the
@XmlSeeAlso annotate.
In fact, for my problem : I have a
Test (abstract class)
-> Test1 (extend Test)
-> Test2 (extend Test)
In the WSDL, I have an operation that take a List of Test (the List can have Test1
or Test2). In my underlying, I make a instanceof check to call a different process
depending if I have an instance of Test1 or Test2.
Currently, JAXB expects an implementation class (not an abstract one).
So I have three solutions :
1/ I can annotate the List with @any but it means that the List can contains any
objects (so that can be different from the Test super class)
2/ I can use an Adapter, but as I don't have an interfance (but an abstract class),
the adapter is not polymorphic (it's an aggregate of Test1 and Test2 attributes)
3/ I have annotate the list with @XmlElements that describe the content of the List
(Test1 or Test2). In this case, the abstract class Test is not used, it's directly
implementation classes.
If you have a more beautiful solution, it's welcome :)
Thanks,
Regards
JB
On Wednesday 21 January 2009 - 19:41, Freeman Fang wrote:
> Jean-Baptiste Onofré wrote:
>> Hi all,
>>
>> I use a HTTP SU with a CXF-SE SU.
>>
>> In the WSDL, I have ValueObject as complexType. The WSDL looks good.
>>
>> If the complexType is a POJO class, there is no problem, it works fine.
>>
>> But, in one WebService, I have a abstract class as complexType. I would like to
>> use the class that extend the super one transparently.
>>
>> Is it possible to use a abstract class as operation argument ?
>> Is there any special annotate in the CXF-SE POJO to do it ?
>>
> In your case, by default the extended class is not recognized by jaxb,
> so you need add the extended class as extra class to the jaxb context.
> You can see the discussed solution from CXF-340 [1]
> [1]https://issues.apache.org/jira/browse/CXF-340
> Freeman
>> Thanks,
>> Regards
>> JB
>>
>
--
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086
Re: WSDL complexType and Abstract classes
Posted by Freeman Fang <fr...@gmail.com>.
Jean-Baptiste Onofré wrote:
> Hi all,
>
> I use a HTTP SU with a CXF-SE SU.
>
> In the WSDL, I have ValueObject as complexType. The WSDL looks good.
>
> If the complexType is a POJO class, there is no problem, it works fine.
>
> But, in one WebService, I have a abstract class as complexType. I would like to
> use the class that extend the super one transparently.
>
> Is it possible to use a abstract class as operation argument ?
> Is there any special annotate in the CXF-SE POJO to do it ?
>
In your case, by default the extended class is not recognized by jaxb,
so you need add the extended class as extra class to the jaxb context.
You can see the discussed solution from CXF-340 [1]
[1]https://issues.apache.org/jira/browse/CXF-340
Freeman
> Thanks,
> Regards
> JB
>