On Tuesday, November 29, 2011 3:38:19 PM Jeremy Robertson wrote:
> I endorsed jaxb-api (version 2.2.1), and it did allow me to put XmlElement
> on an input, but it wouldn't allow the XmlSchemaType element--do you know
> if that is in a later patch version of 2.2?

Apparently not.  :-(   I thought they had updated all the annotations to allow 
them to be on a parameter.   Apparently they didn't.    I guess the other 
options are the only options for this now.  :-(

Dan

> 
> 
> Thanks,
> Jeremy Robertson
> 
> -----Original Message-----
> From: Daniel Kulp [mailto:[email protected]]
> Sent: Wednesday, November 09, 2011 10:53 AM
> To: [email protected]
> Cc: Jeremy Robertson
> Subject: Re: CXF/JAXB Code-first service: modify XMLSchemaType of inputs
> 
> On Tuesday, November 08, 2011 9:19:45 PM Jeremy Robertson wrote:
> > I am working on a CXF/JAXB code-first web service. I would like to be
> > able to modify the WSDL definitions of some of the inputs.
> > 
> > For example, given the following interface snippet:
> >     @WebMethod
> >     public void Something(@WebParam(name="date") Date date);
> > 
> > The WSDL will generate the XMLSchema for the input "date" to be a
> > "datetime" xml element. I would like it to be simply a "date" element
> > instead.
> > 
> > It would also be nice to be able to specify the some of the other input
> > attributes, such as minOccurs, etc.
> > 
> > For a custom object, the sub-elements can define all of these things
> > through annotations such as XmlElement and XmlSchemaType. However,
> > these annotations are not legal on an input parameter.
> > 
> > I know earlier versions of CXF did not handle this, but I'm not sure
> > about the later versions. I'm currently running CXF 2.3.5.
> 
> There are three ways to handle this:
> 
> 1) Endorse the JAXB 2.2 API jar via one of the JDK endorsement mechanisms.
> Then the XmlElement and XmlSchemaType annotations can be used on the
> parameter.
> 
> 2) Create the wrapper type beans (you can use java2ws -warpperBeans as a
> starting point) and add the @RequestWrapper/@ResponseWrapper annotations to
> the method to point at them.   You can finely control the appearance of the
> wrapper schema via annotations in the beans.
> 
> 3) You CAN configure extra subclasses of AbstractServiceConfiguration into
> the factories where you override some of the methods to set various
> minOccurs/maxOccurs/etc.. type things.   VERY fine level of control, but
> very complex to do.
-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to