You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Matthew Shaw <Ma...@facet.com.au> on 2009/11/27 03:24:01 UTC
JAXB bean with no root element
Hi,
I'd like to return JSON from my service, more specifically I'd like to
return a bean which is derived, not annotated with the XMLRootElement. I
have followed instructions on the web site and this is what I have come
up with, but it is not working for me. Any help is greatly appreciated.
<jaxrs:server id="customerRSService" address="/customerservice">
<jaxrs:serviceBeans>
<ref bean="customerService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jaxbProvider"/>
</jaxrs:providers>
</jaxrs:server>
<util:map id="jaxbElementClassMap"
map-class="java.util.Hashtable">
<entry key="com.facet.peak3.emi.domain.model.CustomerType"
value="{urn:xml-facet-com:peak3:emi:data:final:PK3EMI:1.0}CustomerType"/
>
</util:map>
<bean id="jaxbProvider"
class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
<!-- <property name="schemaHandler" ref="schemaHolder" />-->
<property name="marshallAsJaxbElement" value="true"/>
<property name="jaxbElementClassMap"
ref="jaxbElementClassMap"/>
</bean>
Cheers,
Matt.
Re: JAXB bean with no root element
Posted by Sergey Beryozkin <sb...@progress.com>.
Hi
Can you please post a sample "com.facet.peak3.emi.domain.model.CustomerType" (with superclasses if any) ? It does not have to be the
same as the one you actually use...Just curious, if "urn:xml-facet-com:peak3:emi:data:final:PK3EMI:1.0" is the kind of namespace
which JAXB does not like ? What happens if you replace it with say "http://xml-facet-com/peak3/emi/data/final/PK3EMI/1.0" ?
thanks, Sergey
----- Original Message -----
From: "Matthew Shaw" <Ma...@facet.com.au>
To: <us...@cxf.apache.org>
Sent: Friday, November 27, 2009 2:24 AM
Subject: JAXB bean with no root element
Hi,
I'd like to return JSON from my service, more specifically I'd like to
return a bean which is derived, not annotated with the XMLRootElement. I
have followed instructions on the web site and this is what I have come
up with, but it is not working for me. Any help is greatly appreciated.
<jaxrs:server id="customerRSService" address="/customerservice">
<jaxrs:serviceBeans>
<ref bean="customerService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="jaxbProvider"/>
</jaxrs:providers>
</jaxrs:server>
<util:map id="jaxbElementClassMap"
map-class="java.util.Hashtable">
<entry key="com.facet.peak3.emi.domain.model.CustomerType"
value="{urn:xml-facet-com:peak3:emi:data:final:PK3EMI:1.0}CustomerType"/
>
</util:map>
<bean id="jaxbProvider"
class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
<!-- <property name="schemaHandler" ref="schemaHolder" />-->
<property name="marshallAsJaxbElement" value="true"/>
<property name="jaxbElementClassMap"
ref="jaxbElementClassMap"/>
</bean>
Cheers,
Matt.