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.) Dan 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 > -http://www.nabble.com/set-Default-minOccurs-and-nillable-Parameters-td1529 >1545.html#a15291545 > > 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 (http://cwiki.apache.org/CXF20DOC/aegis-databinding.html) > seems to describe this using the Aegis data binding, but I am using the > default JAXB binding. > > Thanks in advance. -- Daniel Kulp [email protected] http://dankulp.com/blog
