Metro and auto-generating stubs that implement java.io.Serializable
I have a wicket application that deals with the bunch of Java classes that were generated from the wsimport utility of Metro. A lot of these objects are pojos, such as a "AttributeHolder" that I need to send to the webservice from a wicket-based client program. For this to work, I need all the pojo's that I am binding to forms and my session to implement java.io.Serializable.
Initially, I made these edits by hand, however, anytime I changes my wdsl, I would have to do a regen of the stubs, and my changes were lost. I was on the verge of writing a custom program that would do some regex replacements on my java files so that after the wsimport process, I would run my program to convert the source code to implement java.io.Serializable. Crazy idea, isn't it?
In my due diligence, I did a quick google, and 10 mins later, I had a repeatable process that did what I wanted (implement java.io.Serializable) for all my classes.
In summary, all I had to do was create a jaxb-bindings.xml file. Mine is here: http://stitches.googlecode.com/svn/trunk/stitches-client/jaxb-bindings.xml
Then run the wsimport option with a "-b" option that specifies the path to this file.
Here is my entire wsimport command.
wsimport.sh -b ./jaxb-bindings.xml -s ./src/java -d ./wsdl/classes http://demo.philliprhodes.com/stitches-server/services/StitchesService?wsdl

Comments
Post new comment