• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

How to generate Java annotations using Apache Axis

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
Posts: 2968
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Axis 1.x has no idea about annotations so I wouldn't expect any such support.

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.

If you are using Axis 1.x then the most likely route is to stop using its WSDL2Java tool and configure the web service endpoint for the Message service style and use the JAXB (un)marshallers on the SOAP request/response payload.
Anne Thomas Manes: Why you might want to use Axis Message Style

Unofficial JAXB guide
Java EE 5 Tutorial: Chapter 17 Binding between XML Schema and Java Classes
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic