Hi Sergey,

Thanks a lot.

--- Karen

On Tue, Jul 21, 2009 at 8:12 AM, Sergey Beryozkin <[email protected]
> wrote:

>
> Hi
>
> I can see that Wolfgang Laun actually replied, but it appears that he sees
> the output being correct.
> I have asked for some additional clarifications, but in meantime, if you do
> need that specific output being produced, then we might be able to extend
> JAXBElementProvider to wrap certain types into JAXBElements which will
> result in the output you need. Lets see what Wolfgang replies and if says
> 'not possible' then I'll give it a try
>
> Cheers, Sergey
>
>
>
> Sergey Beryozkin wrote:
> >
> > Hi,
> >
> > Thanks for posting it. Actually, you'll likely get a faster response if
> > you ask on the jaxb-users list, as opposed to jaxb-dev. If you do post to
> > the users as well, then please consider dropping my response as it makes
> > it a bit more difficult for JAXB experts out there to see what the real
> > issue is, just ask them what is the way to force JAXB to introduce
> > xsi:type into a serialized XML fragment for DerivedType, given the
> > original schema
> >
> > cheers, Sergey
> >
> >
> >
> > Qzpmwo wrote:
> >>
> >> Hi Sergey,
> >>
> >> Thanks a lot for so fast response and your investigation. I have posted
> >> my initial email and your response to jaxb nabble.
> >>
> >>
> >>
> >>
> >> Sergey Beryozkin wrote:
> >>>
> >>> Hi
> >>>
> >>> I've experimented a bit and I've managed to have a test producing the
> >>> expected data, but only when using an explicit JAXBElement, this one
> >>>
> >>> @Test
> >>> public void testWriteDerivedTypeJaxbElement() throws Exception {
> >>>         JAXBElementProvider provider = new JAXBElementProvider();
> >>>         Method m = CollectionsResource.class.getMethod("getBaseJaxb",
> >>> new Class[0]);
> >>>         DerivedType derived = new DerivedType();
> >>>         JAXBElement<BaseType> jaxb = new
> >>> JAXBElement<BaseType>(_Base_QNAME, BaseType.class, null, derived);
> >>>         ByteArrayOutputStream bos = new ByteArrayOutputStream();
> >>>         provider.writeTo(jaxb, m.getReturnType(),
> >>> m.getGenericReturnType(),
> >>>                        new Annotation[0], MediaType.TEXT_XML_TYPE, new
> >>> MetadataMap<String, Object>(), bos);
> >>>         String s = bos.toString();
> >>>         System.out.println(s);
> >>>
> >>> }
> >>>
> >>> produces
> >>>
> >>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:base
> >>> xmlns:ns2="http://www.cisco.com/dms/xml/ns/dsmCommonService";
> >>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> >>> xsi:type="ns2:DerivedType"/>
> >>>
> >>> I'm presuming you have a method like this one :
> >>>
> >>>
> >>> public class RootResource {
> >>>   @GET
> >>>   public BaseType getType() { return new DerivedType(); }
> >>> }
> >>>
> >>> I'm not sure why JAXB chooses to serialize it as
> >>>
> >>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:derivedType
> >>> xmlns:ns2="http://www.cisco.com/dms/xml/ns/dsmCommonService"/>
> >>>
> >>> in this case, given that ObjectFactory has a method returning
> >>> JAXBElement<BaseType>. I tried to force an ObjectFactory method
> >>> returning JAXBElement<BaseType> be used, I removed @XmlRootElement on
> >>> BaseType but it didn't make any difference. Removing @XmlRootElement on
> >>> DerivedType causes a JAXB failure - though ObjectFactory has a method
> >>> returning JAXBElement<DerivedType>.
> >>>
> >>> Can you please post a question to the JAXB users list ? I'd be
> >>> interested to see what they reply. Unless our resident experts (Dan,
> >>> Benson) can help ?
> >>>
> >>> thanks, Sergey
> >>>
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Possible-problem-with-JAXB-marshalling-tp24549727p24586518.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Reply via email to