Use JAX-B or Castor for document-style encoding?


For my Open Source project, I want to expose a stateless session bean (SLSB) as web service using JBoss 3.2 and Axis 1.1. Now I’m wondering whether to use JAX-B or Castor for my document-style encoding, since the information I found in “Create Web services using Apache Axis and Castor” on IBM’s developerWorks may be a bit outdated already. Any thoughts on this?

By the way, this document clearly describes Axis 1.1 and JBoss 3.2.x configuration, exactly for this purpose (exposing a SLSB as WS using Axis and JBoss).

About Author

AMIS employee


  1. Pingback: Bad Credit Car Loans Now

  2. Pingback: Business Credit Card

  3. Pingback: Tubas

  4. xmlbeans is a superb API as long as you have a schema not a DTD for your document, which obviously is your case, too. Unfortunately, I cannot comment upon its integration with Axis, but I think you’ll probably have the same namespace ‘issues’ as the one related to Castor, mentioned by Dan.

  5. Zeger Hendrikse on

    No problems with xmlbeans, I think (I haven’t got experience). But if there are any arguments in favour of it (such as ease of use :-), I’ll surely consider it an option.

  6. From my experience with Castor and Axis, I would say that it works pretty well. IBM’s excellent article
    provides a solid roadmap for implementing DOC/Literal. My process for managing changes in the interface
    (new fields exposed in the service) is pretty simple. I make a change in the schema, run an ant target
    to generate binding classes, merge generated classes with my code base, recompile and deploy. Issues
    to watch out for include:

    – namespaces in the schema: I found that the xml returned from the service contained namespace prefixes
    for every attribute and element! I ended up removing namespace settings from within the generated classes.

    – Axis bug fixes: There were a few classes in Axis that had bugs relating to Castor. I grabbed the fixes from
    cvs because they weren’t included in the standard Axis distribution (can’t remember what classes were fixed).

    I’m sure there are better ways to implement now. I haven’t played with JAX-B so I don’t know how easy it is.

    Good Luck!