On Wednesday 26 May 2010 1:54:53 pm Paul Lowry wrote: > Hi, > > I am trying to expose several plain Java interfaces as web services, using > CXF / java2ws / wsdl2java. > > My original plan was to... > > (1) use java2ws generate WSDL and XSD files from the existing POJO > classes > > (2) use wsdl2java to generate new Java sources containing JAX-WS and > JAX-B annotations > > (3) implement web services using these generated files > > However, I found that there are many types missing from the generated XSD > files, because they are not included in the JAX-B mapping. > http://java.sun.com/javaee/5/docs/tutorial/doc/bnazq.html#bnazw > > So I adjusted my plan... > > (1) use java2ws generate WSDL and XSD files from the existing POJO > classes > > (2) modify the generated XSD files by hand, to include XML > representations of the unsupported Java types > > (3) write a JAX-B binding extensions XML file, so that wsdl2java would > know how to handle the additional types > > (4) use wsdl2java to generate new Java sources containing JAX-WS and > JAX-B annotations > > (5) implement web services using these generated files > > However, now I hear that the JAX-B mapping does not (yet) support any > representation of java.util.Map, which is one of the types in my original > POJO files. > http://stackoverflow.com/questions/1881712/is-it-possible-to-use-jaxb-to-m > ap-from-schema-to-a-java-util-map > > So please tell me: > > - is there any way I can do this, which involves modifying the > output of java2ws, or extending the capabilities of java2ws and wsdl2java?
Probably not. > - or... must I add JAX-B annotations to the original Java files? > is there any tool that might speed up this painstaking work? Well, the only things you need to annotate are the areas where the stuff that isn't generated isn't exactly what you want. The MAIN issue will be the Maps and anything else that uses an interface instead of an actual bean. Those will also require an XmlJavaTypeAdapter thing to be created to map the unsupported types into types that are supported. > - or... can you suggest an alternative approach? Define the wsdl contract first, generate code and use the newly generated code and check all the old stuff? ;-) -- Daniel Kulp [email protected] http://dankulp.com/blog
