On Friday 25 June 2010 12:55:54 pm Dennis Sosnoski wrote: > Daniel Kulp wrote: > > Well, another option to consider (I'm not saying this is the way to go, > > just something to consider. I don't even know if this is possible with > > JIBX) is how the JAXWS/JAXB code handles this.... > > > > With JAX-WS/JAXB, it uses ASM to generate, in memory, classes for the > > wrapper element which contains all the JAXB annotations and such > > necessary to completely read/write the entire message body. There is > > then a WrapperHelper to pull the individual params out of that object. > > Thus, JAXB doesn't see the <arg0>Alice</arg0>, it sees the entire > > message as a structure. > > > > Right now, the creation of the wrapper beans is done in the JAX-WS > > frontend, but I could definitely see pushing that into the JAXB > > databinding and allow other databindings to do the same. If you think > > it's possible with JIBX, it's something we could look into more. > > Ah, I hadn't realized this was the approach used by JAX-WS. That does > tie it directly to JAXB and makes it pretty much unusable with other > binding techniques. Ugly.
Yea. The other databindings can make use of wrapper types providing they are pre-generated. For example, with XMLBeans, if the schema used also defines the wrappers, it works fine. The databinding does create the wrapper helper things that are used to pull/set the data from the wrappers. The only thing that cannot be done right now is to fully create the wrappers in memory when they currently do not exist. > > The other option would be to just handle it yourself. Get the element > > text, you know the Class, since it would just be the primitives, the > > number of cases you need to handle is pretty small and most of the code > > is probably already in Aegis someplace. > > The Axis2-JiBX code is already handling unmarshalling of these types, so > I don't think the unmarshalling using JiBX is much of a problem. What's > more difficult is actually relaying the unmarshalled data to the service > method. > > Perhaps the cleanest way to handle this with JiBX in CXF is to have JiBX > generate it's own wrapper classes which are unmarshalled normally. But > then the data needs to be extracted from the wrapper class instance and > passed to the service method. How is JAX-WS handling that extraction and > data-passing step? If we could make it compatible for JiBX perhaps we > could hook into the JAX-WS handling at that point. Databindings can optional return a WrapperHelper object that does this. There is a ReflectionWrapperHelper object in there that can be used as an example. JAXB uses a more optimized version that generates a unique helper using ASM, but reflection is used as a fallback if that fails. (or asm isn't available) Dan > The alternative is probably to only support wrapped method calls for > now, where the wrapper class instance is passed directly to the method. > That's somewhat ugly for client-side code, though. > > - Dennis -- Daniel Kulp dk...@apache.org http://dankulp.com/blog