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 - http://www.talend.com
