cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Using jaxrs XSLTJaxbProvider with jaxws endpoint through JAXRSDataBinding. Is it possible?
Date Wed, 06 Jun 2012 17:13:13 GMT
 

You're slightly backwords...  :-)

You can use CXF DataBinding objects as JAX-RS providers, but not the other 
way around.   Thus, the JAX-RS XSLT thing isn't usable with a SOAP based 
service.

One option for you may be to configure in the SAAJ interceptor and then 
write a simple interceptor that would take the SAAJ model (it's a DOM) and 
manipulate the SAAJ model, possibly even via XSLT.

Dan


On Wednesday, June 06, 2012 03:31:07 AM n99 wrote:
> Hello
> 
> I've scaffolded a web service server using Spring STS and MyEclipse for
> spring and was interested in transforming the out going soap message.
> 
> First thing I wanted to transform was the namespace prefixing so my spring
> config looked like this
> 
> 	<jaxws:endpoint xmlns:tns="https://etc etc">
> 		<jaxws:dataBinding>
> 			<ref bean="data-binding"/>
>         	</jaxws:dataBinding>
> 	</jaxws:endpoint>
> 
> 
>       	<bean ref="data-binding"
> class="org.apache.cxf.jaxb.JAXBDataBinding"> <property
> name="namespaceMap">
> 	   	 	<map>
> 		   		<entry>
>       	 			   <key>
> 		                      <value>http://thing</value>
> 		                   </key>
>                 		   <value>BeepBeep</value>
> 		   		</entry>
>       			</map>
> 	        </property>
>       </bean>
> 
> this worked fine and my soap message was outputted completely and
> correctly.
> 
> <as>
> 	<BeepBeep: b>
> 		<stuff/>
> 	</BeepBeep:b>
> 	<c>
> 	     <more stuff/>
> 	</c>
> </as>
> 
> Second I needed to change the soap xml but more than the transform
> features at http://cxf.apache.org/docs/transformationfeature.html allowed
> 
> so I read up about the XSLTJaxbProvider at
> http://cxf.apache.org/docs/jax-rs-advanced-xml.html and plugging in a rs
> provider to a ws binding at
> http://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-CX
> FDataBindingsasJAXRSproviders to create the following config
> 
> 
> <jaxws:endpoint xmlns:tns="https://etc etc">
> 		<jaxws:dataBinding>
> 		     <ref bean="jaxrs-data-binding"/>
>         </jaxws:dataBinding>
> </jaxws:endpoint>
> 
> <bean id="jaxrs-data-binding"
> class="org.apache.cxf.jaxrs.provider.JAXRSDataBinding">
>       		   <property name="namespaceMap">
>     	   <map>
>    		<entry>
>       	 	   <key>
>                       <value>http://thing</value>
>                    </key>
>                    <value>BeepBeep</value>
>    		</entry>
>       		</map>
>         </property>
>         <property name="provider" ref="xsltProvider"/>
> </bean>
> 
>         <bean id="xsltProvider"
> class="org.apache.cxf.jaxrs.provider.XSLTJaxbProvider">
>        		<property name="outTemplate"
> value="classpath:/WEB-INF/templates/transform.xsl"/>
>    	</bean>
> 
> 
> now I get an JAXB Exception: Class not known to this context for classes b
> and c and even if I have an empty xslt stylesheet I get the xml
> 
> <as/>
> 
> I have tinkered with the config to every end and added  @XmlSeeAlso all
> over the place to no avail.
> 
> I guess I have to ask is what I've done possible in config? The fact that
> it all works as expected before I try and wire in the rs provider as a ws
> databinding might mean it's not?
> 
> Any advice greatly appreciated. Maybe there is a better way to use
> xslt/manipulate the xml?
> 
> Thanks
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Using-jaxrs-XSLTJaxbProvider-with-jaxws-e
> ndpoint-through-JAXRSDataBinding-Is-it-possible-tp5709183.html Sent from
> the cxf-user mailing list archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Mime
View raw message