Use JAXB or not


XML & Web services: Use JAXB or not

  1. Use JAXB or not (4 messages)


    I our current project we are interacting with several external systems over http with XML. We have different Gateway components which java interface to these systems. We give POJOs to these gateways and get back POJOs. Gateway components convert the POJOs to XML and vice versa.
    Initially we were thinking of using JAXB in the gateway components. But after looking at the amount of code JAXB generates and the way it generates it, we thought it would be better if we write custom beans.
    Are there any patterns/standard practices for this type of problem? Any good experiences with JAXB?


    Threaded Messages (4)

  2. Use JAXB or not[ Go to top ]

    Having used JAXB on atleast 3 projects, I can say that I have had only good experiences with it. The only problem(labor intensive step) is to take the data from the JAXB objects and setup your POJOs. You have to copy stuff over. I am sure that someone out there has come up with a better way to do this.

    The other issue is to maintain the XML schemas in sync with the generated source code. Nothing that cannot be solved by using CVS (or any other source control). You should preferably maintain the schemas and the generated source as a separate project or tree in your current source. Have your build process generate the JAXB classes and use the jars in your classpath.
  3. JAXB[ Go to top ]

    I have used XML Binding on a few projects recently, JAXB on the last couple, and I generally like it..

    I would make two observations though, JAXB can be a bit slow when marshalling/unmarshalling and the need to use the ObjectFactory to create each element can get a bit annoying.

    In one instance we ended up using castor because we found it performed better.

    Depending on the structure of your XML VO + POJO, you may want to consider Jakarta BeanUtils to populate your XML VO from your POJO (visa versa). Or maybe you could look at Jakarta Digester.


  4. JAXB[ Go to top ]


    Look into BeanUtils.copyProperties(...), or PropertyUtils.copyProperties(...)

  5. Use JAXB or not[ Go to top ]

    You can also loko at