cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillermo Lopez Mackinnon <gmlopez.mackin...@gmail.com>
Subject Re: polymorphic parameters not working
Date Fri, 17 May 2013 19:45:19 GMT
Hi,
Thanks for your feedback!

I finally got this resolved. I'm working on a JEE 6 application over JBoss
7 and have all my interfaces (including DTOs) published as modules. Even I
was getting no error message and behavior was almost as expected I should
have declared a dependency over jaxb api. Once I add it to my interfaces
module I started getting the serialization as expected.

The only required annotation in this case was XmlSeeAlso to let jaxb know
about my sub classes.

Thanks again!

Guillermo


On Fri, May 17, 2013 at 6:02 AM, Daniel Kulp <dkulp@apache.org> wrote:

>
> On May 16, 2013, at 7:10 PM, Guillermo Lopez Mackinnon <
> gmlopez.mackinnon@gmail.com> wrote:
>
> > Hi,
> > I'm developing a web service and I need it to accept a polymorphic
> > parameter. For example, imagine an operation named
> > processRequests(List<Request> requests) which may accept a "Request" and
> a
> > "CustomRequest" type (extending from Request) and possibly some others.
> It
> > is my understanding that it should be possible to achieve however no
> matter
> > how I do it I allways get the parameter unmarshaled as the base class and
> > if I place any of the subtype's properties I get an unmarshall exception
> > (unexpected element).
> >
> > I'm testing by using SOAP UI and the request parameter is as the
> following:
> >
> > <requests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:type="customRequest">
> > </request>
> > And the pojos look as the following:
> >
> >
> > @XmlRootElement
> > @XmlSeeAlso({CustomRequest.class})
> > publc class Request {}
> >
> > public class CustomRequest extends Request{}
> >
> > It may be worth to note that I'm developing this as an EJB web service
> with
> > JBoss 7 and I'd say the cxf version is 2.4.8.
> >
> > I'd say this should work but I cannot get it to work...
> >
> > Moreover the wsdl does not displays the subtype definition so I had to
> > manually add this definition but the situation has not changed.
>
>
> If the WSDL doesn't contain the type, then JAXB wouldn't know about it and
> nothing would work.  Adding it by hand wouldn't help.
>
> Do both Request and CustomRequest have an @XmlType annotation on them with
> a non-empty name attribute?   If not, try adding that.   The XmlRootElement
> annotation on Request is likely creating a root element with an anonymous
> type in it. You cannot "extend" that type of Type in the wsdl so it's
> possible that that is the reason.
>
> If that doesn't help, please log an issue with a simple test case.
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message