How to generate Java annotations using Apache Axis
wahed khan
Greenhorn
Joined: Nov 09, 2007
Posts: 3
posted
0
Using Apache Axis iam doing wsdl2java (my wsdl have xsd reference). I am able to generate the stubs, skeletons, serializable java beans.
I receive input as java objects and need to marshall them into XML that is to be passed to some other application.
I am using JAXB to do marhsalling of java objects to XML.
JAXB requires that the java beans must have annotations @XmlElement(name="fieldName")
The java beans that are generated using Axis doesn't have annotations. Is there a way by which i can get annotations for the java beans generated through Axis?
With Axis2 JAXB 2.0 RI (and JaxMe 2) support is still experimental. WSDL2Code databinding support is limited to ADB (Axis2 Data Binding), XmlBeans and JiBX. So again I wouldn't expect that kind of support. Command Line Version Option reference
Originally posted by wahed khan: JAXB requires that the java beans must have annotations @XmlElement(name="fieldName")
As far as I recall that annotation is only important if you intend to generate an XML Schema from your Java Classes. The fact that you are using a WSDL indicates that you already have an XML Schema (that schema may be contained within the WSDL) - so JAXB will generate the marshaller and unmarshaller classes from that. If the annotation is important then JAXB xjc will add it during the XML Schema-to-Java code generation. You are most likely using a WSDL2Java that isn't JAXB aware.