Benson,
With JAXB, the default thinking is that if you are running xjc (wsdl2java
calls it), you REALLY want the JAXB generated objects whenever possible.
Thus, it maps to List<Object>. If the incoming XML element maps to something
that JAXB has a mapping to, it will deserialize to the JAXB type and return
that. If it DOESN'T have a mapping, you get the dom.
There is a JAXB customization that will force it into Element. From section
7.12.3 of the JAXB spec:
<xs:complexType name=”foo”>
<xs:sequence>
<xs:any maxOccurs="unbounded" processContents="lax">
<xs:annotation><xs:appinfo>
<jaxb:dom/>
</xs:appinfo></xs:annotation>
</xs:any>
</xs:sequence>
</xs:complexType>
turns into:
import org.w3c.dom.Element;
public class Foo {
@XmlAnyElement(lax=”false”)
List<Element> getContent(){...}
}
Dan
On Wed July 15 2009 10:22:14 am Benson Margulies wrote:
> In my ongoing saga of explaining the Java web service world to an
> involuntary convert from Microsoft, I find myself faced with another
> question.
>
> In Aegis, you can just use org.w3c.dom.Document as a method return
> type or parameter or property, and good things happen. (Well, one
> slightly odd things happens on the client side, but let's not get
> bogged down.)
>
> The appearance to my bit of googling is that the JAX-WS+JAX-B
> equivalent of this is, at best, a mess. If I take a WSDL from Aegis or
> .net and do wsdl2java, I get return type of Object on the WebMethod,
> plus a class with a vector of Objects in it, and perhaps an actual DOM
> node hiding in there.
>
> What appears to be a very simple thing -- have a DOM object as a
> parameter or return value of a Java-first service -- seems to be not
> there.
>
> I'm hoping that I'm missing something here.
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog