Hi,
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?
Thanks,
Unmesh
-
Use JAXB or not (4 messages)
- Posted by: unmesh joshi
- Posted on: March 03 2005 21:36 EST
Threaded Messages (4)
- Use JAXB or not by Sohail Sikora on March 04 2005 11:04 EST
- JAXB by Gary Frost on March 04 2005 12:23 EST
- JAXB by Gary Frost on March 04 2005 12:38 EST
- JAXB by Gary Frost on March 04 2005 12:23 EST
- Use JAXB or not by Sohail Sikora on March 04 2005 11:09 EST
-
Use JAXB or not[ Go to top ]
- Posted by: Sohail Sikora
- Posted on: March 04 2005 11:04 EST
- in response to unmesh joshi
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. -
JAXB[ Go to top ]
- Posted by: Gary Frost
- Posted on: March 04 2005 12:23 EST
- in response to Sohail Sikora
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 http://www.castor.org/ 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.
Gary
Gary -
JAXB[ Go to top ]
- Posted by: Gary Frost
- Posted on: March 04 2005 12:38 EST
- in response to Gary Frost
Beanutils: http://jakarta.apache.org/commons/beanutils/
Look into BeanUtils.copyProperties(...), or PropertyUtils.copyProperties(...)
Digester: http://jakarta.apache.org/commons/digester/ -
Use JAXB or not[ Go to top ]
- Posted by: Sohail Sikora
- Posted on: March 04 2005 11:09 EST
- in response to unmesh joshi
You can also loko at http://bindmark.dev.java.net/current-results.html