cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <>
Subject Re: CXF / JAXB "Java first approach" - remove minOccurs="0"
Date Thu, 29 Jan 2009 21:52:14 GMT

With JAX-WS 2.2, there will be a standard way to do this by allowing the 
XmlElement annotation on the param.   Not for 2.1 though.   :-(

For CXF, there are two options:

1) Generate the request/response wrappers and edit them.   The easiest way is 
to run the java2ws tool and pass the -wrapperbean flag.   That will generate 
some wrapper beans that you can then edit to add the required=true attribute 
onto the bean fields.

2) Create a subclass of AbstractServiceConfiguration and override the 
getWrapperPartMinOccurs to return 1.   Configure that into the ServiceFactory 
using spring config or code.   (this MAY require the 2.1.4-SNAPSHOT as I 
think there was a bug in this area in 2.1.3.   We'll hopefully get 2.1.4 out 
next week.)



On Tuesday 27 January 2009 2:03:27 pm nair_anoop wrote:
> Hello -
>      I am using the "Java first" approach (JAX-WS annotations on the SEI
> and SIB) to "automatically" generate the WSDL at run-time using CXF 2.1.3.
>      Everything seems to be working mostly OK; my question is very similar
> (may be even identical!) to the one here
> -
>      Using the default JAXB binding, is there a way to remove the
> minOccurs=0 attribute from the resultant CXF-generated WSDL. I need this to
> better handle .Net / Java interop.
>     This page (
> seems to describe this using the Aegis data binding, but I am using the
> default JAXB binding.
> Thanks in advance.

Daniel Kulp

View raw message