Wednesday, August 22, 2007

How to make a JAX-WS client reuse existing classes for data binding (3).

Now we have created the customization file for data binding (doesn't matter if manually or using XJC capabilities). The last think we need is to configure the JAX-WS toolkit to use this customization when creating client classes.
  • For the command line wsimport (reference implementation) we just use the option:
    -b  Specify external JAX-WS or JAXB binding files
    (Each <file> must have its own -b)
  • For wsimport ant integration we use
    <wsimport ...>
    <binding dir="${conf.dir}/" includes="a.episode"/>
    </wsimport>
  • For NetBeans IDE 5.5 and higher, you can use the GUI for WSDL customization. See WsdlCustomizer or JAX-WS Customizations made easy with NetBeans 5.5 for more information. Basically you need to create a web service reference, right click, choose Edit Web Service Attributes, go to the WSDL customization -> External binding file and then browse to your binding file. If the file does not appear in the file list because of filter, just go to the right directory and type its name. NetBeans automatically updates the wsimport ant task in jaxws-build.xml file with <binding> tag.

No comments: