Again I write about one of what seems to be my favorite subjects. Binding in Java has, over the years, occupied a bit of time for many Java developers (not that binding is unique to Java). I am thankful for this time because it has ultimately made using really easy.

Despite the busy holiday season now among us (Thanksgiving and Christmas for my family and me) along with the usual stuff, I wanted to write something quickly about NetBeans, specifically about version 6.5 since it was released not that long ago and has something relatively minor but very nice included.

I have, in the post, posted a hack we employ to get JAX-WS to generate property listeners/notifiers in the generated POJOs we rely on for binding (we're using JSR-295).

The NetBeans team resolved an outstanding issue that makes this a good bit easier (although in my opinion it should be default JAX-WS behaviour). Assuming JAX-WS does not yet generate property event notifiers (and last time I checked it did not), you need to add some import options to your web service in NetBeans. If you care to, you can utilize or modify one of the injectors which were written for JAX-WS. In order to use the one I have posted here, follow these steps from within NetBeans (6.5).

  • First import the web service client (as usual) by (right/ctrl) clicking on the project name and selecting "Web Service Client..."
  • Next enter the URL of the WSDL and click Finish
  • Now take advantage of the new options in 6.5 by right (or ctrl) clicking on the name of the newly-created web service client reference and select "Edit Web Service Attributes"
  • Now go to the Wsimport Options tab (which is pictured in the attached image)
  • You'll want to add three items to the Jaxb (xjc) options. These are the three "Option/Value" pairs:
  • Option: value; Value: -cp (this sets the classpath)
  • Option: file; Value: /opt/jaxb2-commons/lib/property-listener-injector-1.1-mod.jar (this is the fully-qualifed file name of where I put the injector on my system)
  • Option: value; Value: -Xinject-listener-code
I hope this helps someone out there who might read this but keep in mind, it is all subject to change. We've been following/using NetBeans and binding for a while and things have progressed nicely overall and we have no reason to suspect this won't continue.

Happy Hacking,
Carl

Comments

Popular posts from this blog

ClassCastException: JAXB

Minishift on HyperV

Parallel to Lincoln's angry letters never sent concept...