JSRs gone wild (JAXB annoyances)

August 16th, 2005

Update: Looks like I’m going to have to eat my words, as it turns out this is very possible. I was just looking at the wrong place. sigh.

First, JAXB 2.0 is very cool. I was able to get up and running with the RI in a few seconds literally. XJC worked like a charm (the schema to POJO generator). Marshalling/unmarshalling was very easy.

However, I am a bit miffed at lack of an API to create a schema from one’s annotated POJOs. Especially when a stated goal is:

JAXB 2.0 will specify the mapping from Java TM to XML Schema.

It assumes I’ll only ever need to generate a schema at build time, and doesn’t even specify a standard way to do that. All I want is:

Document doc = jaxbContext.createSchema("urn:my-namespace");

Why do you need this? Instead of requiring users to build a WSDL document up front and generate stubs for SOAP services, users could create a service class with their JAXB POJOs as the method parameters. Then the SOAP toolkit can build a WSDL document dynamically. XFire can already do this with XMLBeans and I want to be able to do it with JAXB 2.0.

I guess its time to get on the JAXB mailing list…

2 Responses to “JSRs gone wild (JAXB annoyances)”

  1. James Strachan Says:

    Sounds like its time to contribute to the JAXB 2.0 project :)

  2. Kohsuke Kawaguchi Says:

    > It assumes I’ll only ever need to generate a schema at build time,
    > and doesn’t even specify a standard way to do that. All I want is:

    Sure we do. Try:

    jaxbContext.generateSchema(…);

    If your RI doesn’t have this, download the latest one from http://jaxb.dev.java.net/