Saturday, June 30, 2007

New Project == New things to learn

So, I just finished the design for a service (I'll try to keep the names out of this to protect the guilty).  Basically this service plays the middle man between an EJB layer (A) and another EJB layer (B).  We do love our EJB's where I work...

Anyway, EJB Layer B receives XML requests and does magic on them and sends back an answer (or a failure) as XML.  We have the magic DTD and a Schema to help us figure out how to create the right question and how to parse the answer correctly.

As you no doubt know right XML is trivial.  I got a little creative this time and used a decorator pattern to generate the XML, so that was kind of fun... 

Parsing out the XML has been incredibly simple I'm using the Digester library from the jakarta-commons project by apache and the parsing and object instantiation has been a breeze. 

The only problem is that I don't want to have to hand write all of the objects that get populated via the digester.  I initially tried to go the IDE route, I was researching some plugins and found this article it looked pretty promising except I don't have a version of eclipse 3.1 lying around and I can't bring myself to download it.

I have found 3 solutions so far:

  • IBM's XSD-Beans given a DTD or XSD it will auto generate POJO's for you.  But then you are tied to IBM's runtime.   We do run on IBM's WebSphere app server so that's not horrible, but it is kind of yucky.
  • XML Spy from Altova.  This was the easiest by far.  The Enterprise Edition costs $990.00 though, and once the process is done you get your java beans tied to Altova's runtime.   Not so good.
  • Lastly I have tried PlainXML from softAMIS which is a library written on top of JAXB (B for binding).  It eventually worked I did have to do a bit of troubleshooting, no doubt due to my nasty DTD but I did eventually get my java files built.  But they were tied to the PlainXML runtime...

I guess my next steps are to look at JAXB without any wrappers and actually try to figure out what the heck is going on...  All I really want is a set of very simple POJO's that I can initialize out of the digester process, not tied to a specific XML library just simple getters and setters...

<sigh>

Wish me luck.

-Aaron

No comments: