I was able to get this working using trunk. Here¹s a simple example for those interested.
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"> <util:map id="jaxbElementClassMap"> <entry key="org.foo.Bar" value="http://foo.org}Bar"/> </util:map> <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider"> <property name="jaxbElementClassMap" ref="jaxbElementClassMap" /> </bean> <bean id="impl" class="...Impl" /> <jaxws:endpoint id="soapservice" implementor="#impl" address="..." wsdlLocation="..." /> <jaxrs:server id="restservice" address="..."> <jaxrs:providers> <ref bean="jaxbProvider" /> </jaxrs:providers> <jaxrs:serviceBeans> <ref bean="impl" /> </jaxrs:serviceBeans> </jaxrs:server> </beans> Scott From: Sergey Beryozkin <[email protected]> Date: Fri, 7 Aug 2009 05:36:00 -0700 (PDT) To: <[email protected]> Subject: RE: @XmlRootElement with jax-rs/jax-ws I have just updated JAXBElementProvider to properly wrap into JAXBElements those JAXB-generated types which are missing for whatever reasons @XmlRootElement annotations. 'jaxbElementClassNames' list property I referred to earlier can only be used with classes which do have @XmlRootElement annotations, it is really only useful if the serialization of the derived types needs to be affected. I've added a similar jaxbElementClassMap property which contains className to element name pairs, with element names being either simple names or expanded qnames. If an object class has no @XmlRootElement but its name is a key in this map then JAXBElement will be created internally and serialized properly. I think it can be quite useful in a number of cases. Scott - if you need this feature right now then let me know please and I can help you to create a custom JAXBElementProvider which will do it for you, till the fix makes it into the next 2.2.x release. thanks, Sergey
