Hi, I have a question about generating WSDL and Schema in Axis2. We have been using Axis 1.4 for quite some time now and are finally ready to upgrade to Axis2. I've read that a lot of people suggest "starting with the WSDL", but unfortunately we have a lot of existing Web Services and custom data object (not quite JavaBean compatible) that we are hoping to re-use. Previously we would define <typeMapping> tags in the server-config.xml and then implement the writeSchema() method on a custom Serializer class to generate out the correct Schema for the WSDL when we use the Java2WSDL utility.
As I understand it, now the best way to re-use your existing code is to use the JAX-WS and JAXB annotations and then run your code through the Axis2 Java2WSDL utility passing in the "-sg" argument with the value " org.apache.axis2.jaxbri.JaxbSchemaGenerator". I *think* I read that you *may * be able to use JiBX, but we prefer JAX-WS and JAXB because they are standards and in theory should be portable to other platforms and tools as well. Anyway, my Web Service throws a custom Fault that extends org.apache.axis2.AxisFault. So I've gone through and annotated all the classes (including the custom Fault class), but when I run Java2WSDL I get the exception below because it's trying to write the schema for the AxisFault and it's super classes which aren't JAXB compliant: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 8 counts of IllegalAnnotationExceptions org.apache.axis2.AxisFault does not have a no-arg default constructor. this problem is related to the following location: at org.apache.axis2.AxisFault at com.ams.core.webservices.exceptions.BaseFault at com.ams.core.webservices.exceptions.RecoverableFault org.apache.axiom.om.OMElement is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at org.apache.axiom.om.OMElement at public org.apache.axiom.om.OMElement org.apache.axis2.AxisFault.getDetail() at org.apache.axis2.AxisFault at com.ams.core.webservices.exceptions.BaseFault at com.ams.core.webservices.exceptions.RecoverableFault org.apache.axiom.om.OMElement does not have a no-arg default constructor. this problem is related to the following location: at org.apache.axiom.om.OMElement at public org.apache.axiom.om.OMElement org.apache.axis2.AxisFault.getDetail() at org.apache.axis2.AxisFault at com.ams.core.webservices.exceptions.BaseFault at com.ams.core.webservices.exceptions.RecoverableFault org.apache.axiom.om.OMXMLParserWrapper is an interface, and JAXB can't handle interfaces. this problem is related to the following location: at org.apache.axiom.om.OMXMLParserWrapper at public abstract org.apache.axiom.om.OMXMLParserWrapper org.apache.axiom.om.OMElement.getBuilder() at org.apache.axiom.om.OMElement at public org.apache.axiom.om.OMElement org.apache.axis2.AxisFault.getDetail() at org.apache.axis2.AxisFault at com.ams.core.webservices.exceptions.BaseFault at com.ams.core.webservices.exceptions.RecoverableFault .......... My question is, how do you get Java2WSDL or JAXB to ignore Java classes or certain other classes in the Object hierarchy? I tried to put the JAXB 2.1.5jars in the classpath and use the @XmlTransient annotation at the class level by putting a base class in between AxisFault and my custom Fault, but that didn't seem to work either. I would think that this would cause a problem when generating WSDL/Schema for any class that extends certain other classes. Has anyone done this before or have any ideas on how to get around this? I have one last question. Sun's com.sun.tools.ws.WsGen utility from their JAX-WS Reference Implementation generates the WSDL and Schema so that they are broken out into seperate files (WSDL Service/Bindings, WSDL Message and PortTypes, and then a seperate xsd file to define all of the types for a given namespace. Is there any way to get the Axis2 Java2WSDL classes to do this, or does anyone know what I should extend to get this to happen? Thanks in advance, Ben