Using JAXB RI's "simpler and better" binding mode from JAX-WS
My favorite feature in the JAXB RI is the simpler and better binding mode, which makes the generated code even easier to use, by ...
- Eliminating JAXBElement as much as possible
- Giving you a better, more typed binding in general
- Use plural property names where applicable
My previous entry talks about how to use it from JAXB's xjc tool, but of course you can use it from JAX-WS's wsimport tool, because JAX-WS uses JAXB for the databinding. The following example illustrates how:
<wsimport wsdl="http://www.webservicex.com/stockquote.asmx?WSDL"> <binding file="simple-binding.xjb" /> </wsimport>
Click the "simple-binding.xjb" link above to download this file, which is pretty short. The binding element can also be an attribute on <wsimport> element if you only have one binding file.
In upcoming JAX-WS RI 2.1, you can also specify any XJC command line options through wsimport ant task. This is handy, for example, for you to use one of the JAXB RI plugins. The following example illustrates how:
<wsimport wsdl="http://www.webservicex.com/stockquote.asmx?WSDL"> <xjcarg value="-cp"/> <xjcarg file="path/to/fluent-api.jar" /> <xjcarg value="-Xfluent-api"/> </wsimport>
The <xjcarg> element follows the command-line argument mechanism in Ant.
- Login or register to post comments
- Printer-friendly version
- kohsuke's blog
- 3637 reads





