users@jaxb.java.net

Using JAXB with JAXM

From: Brian Hannan <bhannan_at_mac.com>
Date: Mon, 17 Mar 2003 15:47:55 -0700

Please excuse my ignorance if the answer to this is obvious. I'm fairly new to JAXB.

I'm wondering if there is an easy way to process JAXM message content with JAXB? Especially with SOAP? Say, for example, I pass an XML schema struct in a SOAP RPC call. Can I use JAXB to map that XML to Java? The deal is I also use that struct elsewhere besides an argument in a SOAP message. However, when using SOAP I'd like to use the same JAXB classes to go from my XML schema struct in the SOAP envelope to a Java object.

I'd like to have a single uniform API to my XML Java bindings, and not have to go out of my way to convert my Java class to an XML doc so I can send it via a SOAP message. Looking over the dev docs and JavaDocs in the WSDP 1.1 it doesn't appear there is any easy way to do this since the SOAP packages have their own root Node and Element classes.

I can fully appreciate why SOAP elements need specific interfaces, but considering how XML schema friendly SOAP is, having a struct in a SOAP envelope in or in a standalone XML doc will look pretty much the same given they are both XML schema. The only difference will be the containing elements for that struct -- in the case of SOAP it's an envelope.

Looking over the APIs it appears I could try to marshall to a DOM Node and then try to convert that over to SOAP elements. Is this correct? Do I really have to go through this much trouble and object/memory bloat to make it work. If so, is Sun going to fix this? I'd really prefer a single XML/Java serialization/deserialization strategy in the JDK.

Thanks for the help.