Hi, we're working on a project where we're using JAXB generated classes as 'business objects'. These objects are then (also) used for serialization into XML. We have a few services that use these JAXB classes, "jaxb services". Now for every JAXB generated object we have a mapping to an schema file, for instance the JAXB classes "Address" and "AddressType" map to "Address.xsd". This is usefull later on.
We have the (de)serialization working. It is not perfect as of now, but it works. The (de)serialization part was rather easy to accomplish, though we couldnt get the WSDL generation working, so we hacked around it. Reusing part of the BeanSerialization plus some manual labour. (Fear not, its just a few lines :-) The following is a (short) cookbook for exposing a "jaxb services" as web services. We have to do a few steps, namely: 1) Generate a "SOAP service", this is actually the implementing class. This is optional, one could of course later on generate a soap stub and go from there; 2) Invoke Java2WSDL for this "SOAP service", generating a wsdl file; 3) Edit the wsdl file, insert a <wdsl:types>, a <xsd:schema> and for each JAXB type, insert an <xsd:include schemaLocation=".." /> into the document. 4) Invoke WSDL2Java for this wsdl file,. Set the implementation class to the "SOAP service" from step 1 and generate seperate helper classes by setting the -H flag. This will generate axis beans for our JAXB classes as well. 5) Delete those beans, keeping the _Helper files. 6) Search the files for org.axis.encoding.ser.Bean and replace that into the JAXB (de)serializers. Now it's time to deploy (followed by prayer / crossing of fingers ;-) and run a test client. For steps 4,5,6 we've written an ant task, that takes a few parameters and automates this for multiple SOAP services. We've got a more elaborate cookbook, including the (de)serializers source code and the ant task(s). Would the axis community be interrested in this contribution? If so, we could provide someone with the code, who could run a few tests and perhaps check it in into CVS. Please ask for this code, and documentation if this seems useful. Cheers, Rutger Lubbers