You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Lowry <lo...@gmail.com> on 2014/07/17 22:33:44 UTC

help with simple cxf transform feature example

I have a very simple request coming in to my CXF endpoint:

      <myns:getData>
         <SSN></SSN>
         <ReqType></ReqType>
      </myns:getData>

I'd like to transform the request to this (note only change is additional
element 'ReqQName':

      <myns:getData>
         <SSN></SSN>
         <ReqType></ReqType>
         <ReqQName></ReqQName>
      </myns:getData>

My CXF transform applied to CXF endpoint looks like this :

   	
	<bean id="incomingTransformFeature"
class="org.apache.cxf.feature.StaxTransformFeature">
 		<property name="inAppendElements">
  			<map>
  				
  				<entry key="ReqType/" value="ReqQName=TESTQ.TRANSFERS"/>
  			</map>
  		</property>	

	</bean>


The transformed request looks like this:

      <myns:getData>
         <SSN></SSN>
         <ReqType>
             <ReqQName>DEQY.RESEARCH.TRANSFERS</ReqQName>
         </ReqType>
      </myns:getData>

Notice the 'ReqQName' element was placed inside the 'ReqType' element. How
do specify transform that will put the 'ReqQName' *after* the 'ReqType'
element?
 



--
View this message in context: http://cxf.547215.n5.nabble.com/help-with-simple-cxf-transform-feature-example-tp5746620.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: help with simple cxf transform feature example

Posted by Lowry <lo...@gmail.com>.
Thanks again aki, that works!



--
View this message in context: http://cxf.547215.n5.nabble.com/help-with-simple-cxf-transform-feature-example-tp5746620p5746631.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: help with simple cxf transform feature example

Posted by Aki Yoshida <el...@gmail.com>.
cxf's transform feature uses some zen kind of simple idioms to perform
four different element appending operations.
The online documentation describes these four cases but I noticed that
we should add some concrete input/output examples, which are missing.

Okay. Now in your case, you will need:

  <entry key="{urn:myns}getData/" value="ReqQName=TESTQ.TRANSFERS"/>

where getData is from urn:myns namespace as in
<myns:getData xmlns:myns="urn:myns">
  ...

Basically, the insertion itself can be indicated by the value property
configured using the assignment sign like "name=value", which you
already had. The insertion point can be specified as "before the
specified element" or "as the last element within the specified
element", which can be determined by the key value having no ending
slash or having one, respectively.

regards, aki


2014-07-17 22:33 GMT+02:00 Lowry <lo...@gmail.com>:
> I have a very simple request coming in to my CXF endpoint:
>
>       <myns:getData>
>          <SSN></SSN>
>          <ReqType></ReqType>
>       </myns:getData>
>
> I'd like to transform the request to this (note only change is additional
> element 'ReqQName':
>
>       <myns:getData>
>          <SSN></SSN>
>          <ReqType></ReqType>
>          <ReqQName></ReqQName>
>       </myns:getData>
>
> My CXF transform applied to CXF endpoint looks like this :
>
>
>         <bean id="incomingTransformFeature"
> class="org.apache.cxf.feature.StaxTransformFeature">
>                 <property name="inAppendElements">
>                         <map>
>
>                                 <entry key="ReqType/" value="ReqQName=TESTQ.TRANSFERS"/>
>                         </map>
>                 </property>
>
>         </bean>
>
>
> The transformed request looks like this:
>
>       <myns:getData>
>          <SSN></SSN>
>          <ReqType>
>              <ReqQName>DEQY.RESEARCH.TRANSFERS</ReqQName>
>          </ReqType>
>       </myns:getData>
>
> Notice the 'ReqQName' element was placed inside the 'ReqType' element. How
> do specify transform that will put the 'ReqQName' *after* the 'ReqType'
> element?
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/help-with-simple-cxf-transform-feature-example-tp5746620.html
> Sent from the cxf-user mailing list archive at Nabble.com.