You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by cantalou89 <ca...@gmail.com> on 2012/10/14 17:57:25 UTC

StaxTransformFeature outTransformElements problem

Hi all,
I encounter a problem when I used cxf 2.6.2 .
I used StaxTransformFeature with configuration '<entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result" value="result" />' to remove result element's namespace befor the soap message responsed to client. Althought the result element's namespace has removed , but the namespace description xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0 of <ns2:subscribeServCfmResponse> also has been removed, it is not what i want . I just want to replce <ns2:result> of <result> , so how could i do? Thanks .

The spring configuration below:
<jaxws:endpoint id="UserOrderServer" address="/UserOrderServer.jws" implementor="com.funo.ehealth.ws.UserOrderServerImpl">

  <jaxws:outInterceptors>
    <bean name="useForStaxTransformFeature" class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"></bean>
  </jaxws:outInterceptors>
  
  <jaxws:features>
   <bean class="org.apache.cxf.feature.LoggingFeature" />
   <bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature">
     <property name="outTransformElements">
       <map>
        <entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result" value="result" />
       </map>
     </property>
    </bean>
  </jaxws:features>
</jaxws:endpoint>

Before I enable the StaxTransformFeature , the clien received a soap message like below:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Header/>
  <soap:Body>
    <ns2:subscribeServCfmResponse xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common" xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
     <ns2:SubscribeServCfmResp>
      <ns2:result>0</ns2:result>
     </ns2:SubscribeServCfmResp>
   </ns2:subscribeServCfmResponse>
  </soap:Body>
</soap:Envelope> 

AfterI enable the StaxTransformFeature , the clien received a soap message like below:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Header/>
  <soap:Body>
    <ns2:subscribeServCfmResponse xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common" >
     <ns2:SubscribeServCfmResp>
      <result>0</result>
     </ns2:SubscribeServCfmResp>
   </ns2:subscribeServCfmResponse>
  </soap:Body>
</soap:Envelope>




cantalou89

Re: StaxTransformFeature outTransformElements problem

Posted by pcgayan <pc...@gmail.com>.
Thanks for the reply. You're correct. I didn't cleaned the unwanted stuff
before post! I was paying with several options before :)I am still unable to
understand why this is needed? I used this soultion beacuse
http://cxf.547215.n5.nabble.com/How-to-customize-namespaces-position-and-prefix-in-CXF-response-td3423069.html
didnt worked out.Am i missing any configuration on CXF while generating
stubs? Please advise?



--
View this message in context: http://cxf.547215.n5.nabble.com/StaxTransformFeature-outTransformElements-problem-tp5716579p5717468.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: StaxTransformFeature outTransformElements problem

Posted by Glen Mazza <gm...@talend.com>.
None of those <import resource="..."/> statements except for the first 
should be needed in CXF 2.6+ versions (possibly even some older versions 
as well.)

Glen

On 10/25/2012 03:51 PM, pcgayan wrote:
> this post helped!
> was able to resolve namespace appearing on the root element of the body tag!
>
> Here is my exact cxf-servlet:
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:soap="http://cxf.apache.org/bindings/soap"
> 	xsi:schemaLocation="
> 		http://www.springframework.org/schema/beans
> 		http://www.springframework.org/schema/beans/spring-beans.xsd
> 		http://cxf.apache.org/bindings/soap
> 		http://cxf.apache.org/schemas/configuration/soap.xsd
> 		http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
>
> 	<import resource="classpath:META-INF/cxf/cxf.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-xml.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> 	<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
> 	
> 	<jaxws:endpoint id="webService"
> 		implementorClass=src.WebServiceImpl"
> 		implementor="#webService" address="/webService">
> 		 <jaxws:outInterceptors>
> 		    <bean name="transformFeature"
> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"></bean>
> 		  </jaxws:outInterceptors>
> 		
> 		  <jaxws:features>
> 		   <bean class="org.apache.cxf.feature.LoggingFeature" />
> 		   <bean id="transformFeature"
> class="org.apache.cxf.feature.StaxTransformFeature">
> 		     <property name="outTransformElements">
> 		       <map>
> 		        <entry key="{http://XXXX/service/}*" value="*" />
> 		       </map>
> 		     </property>
> 		    </bean>
> 		  </jaxws:features>
>    	</jaxws:endpoint>
> </beans>
>
>
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/StaxTransformFeature-outTransformElements-problem-tp5716579p5717458.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza


Re: StaxTransformFeature outTransformElements problem

Posted by pcgayan <pc...@gmail.com>.
this post helped!
was able to resolve namespace appearing on the root element of the body tag!

Here is my exact cxf-servlet:
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:soap="http://cxf.apache.org/bindings/soap"
	xsi:schemaLocation=" 
		http://www.springframework.org/schema/beans  
		http://www.springframework.org/schema/beans/spring-beans.xsd
		http://cxf.apache.org/bindings/soap  
		http://cxf.apache.org/schemas/configuration/soap.xsd
		http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

	<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-xml.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
	
	<jaxws:endpoint id="webService"
		implementorClass=src.WebServiceImpl"
		implementor="#webService" address="/webService">
		 <jaxws:outInterceptors> 
		    <bean name="transformFeature"
class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"></bean> 
		  </jaxws:outInterceptors> 
		  
		  <jaxws:features> 
		   <bean class="org.apache.cxf.feature.LoggingFeature" /> 
		   <bean id="transformFeature"
class="org.apache.cxf.feature.StaxTransformFeature"> 
		     <property name="outTransformElements"> 
		       <map> 
		        <entry key="{http://XXXX/service/}*" value="*" /> 
		       </map> 
		     </property> 
		    </bean> 
		  </jaxws:features> 
  	</jaxws:endpoint>
</beans>





--
View this message in context: http://cxf.547215.n5.nabble.com/StaxTransformFeature-outTransformElements-problem-tp5716579p5717458.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Re: StaxTransformFeature outTransformElements problem

Posted by Aki Yoshida <el...@gmail.com>.
Hi,
I integrated the change in 2.6.4-SNAPSHOT today.

There is a new test case that looks similar to your case:
http://svn.apache.org/repos/asf/cxf/branches/2.6.x-fixes/api/src/test/java/org/apache/cxf/staxutils/transform/OutTransformWriterTest.java's
testRemoveOneNamespace.

Could you try it out?
thanks.
regards, aki


2012/10/16 cantalou89 <ca...@gmail.com>:
> I had tried with version 2.6.3 , but the issue can not be slove .
> It may be an issue .
> Thanks all.
>
>
>
> cantalou89
>
> From: Aki Yoshida
> Date: 2012-10-16 01:28
> To: users
> Subject: Re: StaxTransformFeature outTransformElements problem
> hi,
> There seems to be an issue with the namespace replacing feature if the
> namespace replacing must occur at only some specific elements.
>
> I created CXF-4566 to resolve this issue and will submit the fix shortly.
>
> regards, aki
>
> 2012/10/15 Daniel Kulp <dk...@apache.org>:
>>
>> On Oct 15, 2012, at 7:42 AM, Aki Yoshida <el...@gmail.com> wrote:
>>
>>> I don't know why the ns2 prefix binding for those elements is removed.
>>> I'll look into it this afternoon.
>>
>> Can you try with 2.6.3?  We did fix a couple of things related to dropped namespaces for 2.6.3:
>>
>>
>> commit 6993f39bccea4ed126debf88c8fdd842d00b4750
>> Author: Daniel Kulp <dk...@apache.org>
>> Date:   Fri Sep 28 15:48:52 2012 +0000
>>
>>     Per javadoc, empty prefix needs to delgate to writeDefaultNamespace
>>
>>     git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1391510 13f79535-47bb-0310-9956-ffa450edef68
>>
>> commit 65aed4a841de14f1a7caec6fd1f0ebc28b79245b
>> Author: Akitoshi Yoshida <ay...@apache.org>
>> Date:   Thu Sep 13 15:17:46 2012 +0000
>>
>>     [CXF-4503] TransformOutInterceptor may lose namespace declarations in some elements
>>
>>     git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1384365 13f79535-47bb-0310-9956-ffa450edef68
>>
>>
>>
>> Dan
>>
>>
>>
>>>
>>> 2012/10/15 Sergey Beryozkin <sb...@gmail.com>:
>>>> Hi
>>>>
>>>> On 14/10/12 16:57, cantalou89 wrote:
>>>>>
>>>>> Hi all,
>>>>> I encounter a problem when I used cxf 2.6.2 .
>>>>> I used StaxTransformFeature with configuration '<entry
>>>>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>>>>> value="result" />' to remove result element's namespace befor the soap
>>>>> message responsed to client. Althought the result element's namespace has
>>>>> removed , but the namespace description
>>>>> xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0
>>>>> of<ns2:subscribeServCfmResponse>  also has been removed, it is not what i
>>>>> want . I just want to replce<ns2:result>  of<result>  , so how could i do?
>>>>> Thanks .
>>>>>
>>>>> The spring configuration below:
>>>>> <jaxws:endpoint id="UserOrderServer" address="/UserOrderServer.jws"
>>>>> implementor="com.funo.ehealth.ws.UserOrderServerImpl">
>>>>>
>>>>>   <jaxws:outInterceptors>
>>>>>     <bean name="useForStaxTransformFeature"
>>>>> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"></bean>
>>>>>   </jaxws:outInterceptors>
>>>>>
>>>>>   <jaxws:features>
>>>>>    <bean class="org.apache.cxf.feature.LoggingFeature" />
>>>>>    <bean id="transformFeature"
>>>>> class="org.apache.cxf.feature.StaxTransformFeature">
>>>>>      <property name="outTransformElements">
>>>>>        <map>
>>>>>         <entry
>>>>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>>>>> value="result" />
>>>>>        </map>
>>>>>      </property>
>>>>>     </bean>
>>>>>   </jaxws:features>
>>>>> </jaxws:endpoint>
>>>>>
>>>>> Before I enable the StaxTransformFeature , the clien received a soap
>>>>> message like below:
>>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>>>  <soap:Header/>
>>>>>   <soap:Body>
>>>>>     <ns2:subscribeServCfmResponse
>>>>> xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common"
>>>>> xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
>>>>>      <ns2:SubscribeServCfmResp>
>>>>>       <ns2:result>0</ns2:result>
>>>>>      </ns2:SubscribeServCfmResp>
>>>>>    </ns2:subscribeServCfmResponse>
>>>>>   </soap:Body>
>>>>> </soap:Envelope>
>>>>>
>>>>> AfterI enable the StaxTransformFeature , the clien received a soap message
>>>>> like below:
>>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>>>  <soap:Header/>
>>>>>   <soap:Body>
>>>>>     <ns2:subscribeServCfmResponse
>>>>> xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common">
>>>>>      <ns2:SubscribeServCfmResp>
>>>>>       <result>0</result>
>>>>>      </ns2:SubscribeServCfmResp>
>>>>>    </ns2:subscribeServCfmResponse>
>>>>>   </soap:Body>
>>>>> </soap:Envelope>
>>>>>
>>>>
>>>> It looks like a bug, at the moment the feature tries to avoid the
>>>> 'left-over' prefixes leaking into the transformed representations (as often
>>>> no traces of the 'old' namespace are expected), but in this case it breaks
>>>> it.
>>>>
>>>> Can you have something like
>>>>
>>>>
>>>> <map>
>>>>      <entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>>>> value="result" />
>>>>      <entry
>>>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse"
>>>> value="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse"
>>>> />
>>>> </map>
>>>>
>>>> and check if it helps to retain this specific namespace ? If not then we
>>>> will introduce a property for the namespace declarations be optionally
>>>> retained
>>>>
>>>> Sergey
>>>>
>>>>>
>>>>>
>>>>>
>>>>> cantalou89
>>>>
>>>>
>>>>
>>>> --
>>>> Sergey Beryozkin
>>>>
>>>> Talend Community Coders
>>>> http://coders.talend.com/
>>>>
>>>> Blog: http://sberyozkin.blogspot.com
>>
>> --
>> Daniel Kulp
>> dkulp@apache.org - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com
>>

Re: Re: StaxTransformFeature outTransformElements problem

Posted by cantalou89 <ca...@gmail.com>.
I had tried with version 2.6.3 , but the issue can not be slove .
It may be an issue .
Thanks all. 



cantalou89

From: Aki Yoshida
Date: 2012-10-16 01:28
To: users
Subject: Re: StaxTransformFeature outTransformElements problem
hi,
There seems to be an issue with the namespace replacing feature if the
namespace replacing must occur at only some specific elements.

I created CXF-4566 to resolve this issue and will submit the fix shortly.

regards, aki

2012/10/15 Daniel Kulp <dk...@apache.org>:
>
> On Oct 15, 2012, at 7:42 AM, Aki Yoshida <el...@gmail.com> wrote:
>
>> I don't know why the ns2 prefix binding for those elements is removed.
>> I'll look into it this afternoon.
>
> Can you try with 2.6.3?  We did fix a couple of things related to dropped namespaces for 2.6.3:
>
>
> commit 6993f39bccea4ed126debf88c8fdd842d00b4750
> Author: Daniel Kulp <dk...@apache.org>
> Date:   Fri Sep 28 15:48:52 2012 +0000
>
>     Per javadoc, empty prefix needs to delgate to writeDefaultNamespace
>
>     git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1391510 13f79535-47bb-0310-9956-ffa450edef68
>
> commit 65aed4a841de14f1a7caec6fd1f0ebc28b79245b
> Author: Akitoshi Yoshida <ay...@apache.org>
> Date:   Thu Sep 13 15:17:46 2012 +0000
>
>     [CXF-4503] TransformOutInterceptor may lose namespace declarations in some elements
>
>     git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1384365 13f79535-47bb-0310-9956-ffa450edef68
>
>
>
> Dan
>
>
>
>>
>> 2012/10/15 Sergey Beryozkin <sb...@gmail.com>:
>>> Hi
>>>
>>> On 14/10/12 16:57, cantalou89 wrote:
>>>>
>>>> Hi all,
>>>> I encounter a problem when I used cxf 2.6.2 .
>>>> I used StaxTransformFeature with configuration '<entry
>>>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>>>> value="result" />' to remove result element's namespace befor the soap
>>>> message responsed to client. Althought the result element's namespace has
>>>> removed , but the namespace description
>>>> xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0
>>>> of<ns2:subscribeServCfmResponse>  also has been removed, it is not what i
>>>> want . I just want to replce<ns2:result>  of<result>  , so how could i do?
>>>> Thanks .
>>>>
>>>> The spring configuration below:
>>>> <jaxws:endpoint id="UserOrderServer" address="/UserOrderServer.jws"
>>>> implementor="com.funo.ehealth.ws.UserOrderServerImpl">
>>>>
>>>>   <jaxws:outInterceptors>
>>>>     <bean name="useForStaxTransformFeature"
>>>> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"></bean>
>>>>   </jaxws:outInterceptors>
>>>>
>>>>   <jaxws:features>
>>>>    <bean class="org.apache.cxf.feature.LoggingFeature" />
>>>>    <bean id="transformFeature"
>>>> class="org.apache.cxf.feature.StaxTransformFeature">
>>>>      <property name="outTransformElements">
>>>>        <map>
>>>>         <entry
>>>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>>>> value="result" />
>>>>        </map>
>>>>      </property>
>>>>     </bean>
>>>>   </jaxws:features>
>>>> </jaxws:endpoint>
>>>>
>>>> Before I enable the StaxTransformFeature , the clien received a soap
>>>> message like below:
>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>>  <soap:Header/>
>>>>   <soap:Body>
>>>>     <ns2:subscribeServCfmResponse
>>>> xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common"
>>>> xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
>>>>      <ns2:SubscribeServCfmResp>
>>>>       <ns2:result>0</ns2:result>
>>>>      </ns2:SubscribeServCfmResp>
>>>>    </ns2:subscribeServCfmResponse>
>>>>   </soap:Body>
>>>> </soap:Envelope>
>>>>
>>>> AfterI enable the StaxTransformFeature , the clien received a soap message
>>>> like below:
>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>>  <soap:Header/>
>>>>   <soap:Body>
>>>>     <ns2:subscribeServCfmResponse
>>>> xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common">
>>>>      <ns2:SubscribeServCfmResp>
>>>>       <result>0</result>
>>>>      </ns2:SubscribeServCfmResp>
>>>>    </ns2:subscribeServCfmResponse>
>>>>   </soap:Body>
>>>> </soap:Envelope>
>>>>
>>>
>>> It looks like a bug, at the moment the feature tries to avoid the
>>> 'left-over' prefixes leaking into the transformed representations (as often
>>> no traces of the 'old' namespace are expected), but in this case it breaks
>>> it.
>>>
>>> Can you have something like
>>>
>>>
>>> <map>
>>>      <entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>>> value="result" />
>>>      <entry
>>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse"
>>> value="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse"
>>> />
>>> </map>
>>>
>>> and check if it helps to retain this specific namespace ? If not then we
>>> will introduce a property for the namespace declarations be optionally
>>> retained
>>>
>>> Sergey
>>>
>>>>
>>>>
>>>>
>>>> cantalou89
>>>
>>>
>>>
>>> --
>>> Sergey Beryozkin
>>>
>>> Talend Community Coders
>>> http://coders.talend.com/
>>>
>>> Blog: http://sberyozkin.blogspot.com
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>

Re: StaxTransformFeature outTransformElements problem

Posted by Aki Yoshida <el...@gmail.com>.
hi,
There seems to be an issue with the namespace replacing feature if the
namespace replacing must occur at only some specific elements.

I created CXF-4566 to resolve this issue and will submit the fix shortly.

regards, aki

2012/10/15 Daniel Kulp <dk...@apache.org>:
>
> On Oct 15, 2012, at 7:42 AM, Aki Yoshida <el...@gmail.com> wrote:
>
>> I don't know why the ns2 prefix binding for those elements is removed.
>> I'll look into it this afternoon.
>
> Can you try with 2.6.3?  We did fix a couple of things related to dropped namespaces for 2.6.3:
>
>
> commit 6993f39bccea4ed126debf88c8fdd842d00b4750
> Author: Daniel Kulp <dk...@apache.org>
> Date:   Fri Sep 28 15:48:52 2012 +0000
>
>     Per javadoc, empty prefix needs to delgate to writeDefaultNamespace
>
>     git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1391510 13f79535-47bb-0310-9956-ffa450edef68
>
> commit 65aed4a841de14f1a7caec6fd1f0ebc28b79245b
> Author: Akitoshi Yoshida <ay...@apache.org>
> Date:   Thu Sep 13 15:17:46 2012 +0000
>
>     [CXF-4503] TransformOutInterceptor may lose namespace declarations in some elements
>
>     git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1384365 13f79535-47bb-0310-9956-ffa450edef68
>
>
>
> Dan
>
>
>
>>
>> 2012/10/15 Sergey Beryozkin <sb...@gmail.com>:
>>> Hi
>>>
>>> On 14/10/12 16:57, cantalou89 wrote:
>>>>
>>>> Hi all,
>>>> I encounter a problem when I used cxf 2.6.2 .
>>>> I used StaxTransformFeature with configuration '<entry
>>>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>>>> value="result" />' to remove result element's namespace befor the soap
>>>> message responsed to client. Althought the result element's namespace has
>>>> removed , but the namespace description
>>>> xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0
>>>> of<ns2:subscribeServCfmResponse>  also has been removed, it is not what i
>>>> want . I just want to replce<ns2:result>  of<result>  , so how could i do?
>>>> Thanks .
>>>>
>>>> The spring configuration below:
>>>> <jaxws:endpoint id="UserOrderServer" address="/UserOrderServer.jws"
>>>> implementor="com.funo.ehealth.ws.UserOrderServerImpl">
>>>>
>>>>   <jaxws:outInterceptors>
>>>>     <bean name="useForStaxTransformFeature"
>>>> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"></bean>
>>>>   </jaxws:outInterceptors>
>>>>
>>>>   <jaxws:features>
>>>>    <bean class="org.apache.cxf.feature.LoggingFeature" />
>>>>    <bean id="transformFeature"
>>>> class="org.apache.cxf.feature.StaxTransformFeature">
>>>>      <property name="outTransformElements">
>>>>        <map>
>>>>         <entry
>>>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>>>> value="result" />
>>>>        </map>
>>>>      </property>
>>>>     </bean>
>>>>   </jaxws:features>
>>>> </jaxws:endpoint>
>>>>
>>>> Before I enable the StaxTransformFeature , the clien received a soap
>>>> message like below:
>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>>  <soap:Header/>
>>>>   <soap:Body>
>>>>     <ns2:subscribeServCfmResponse
>>>> xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common"
>>>> xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
>>>>      <ns2:SubscribeServCfmResp>
>>>>       <ns2:result>0</ns2:result>
>>>>      </ns2:SubscribeServCfmResp>
>>>>    </ns2:subscribeServCfmResponse>
>>>>   </soap:Body>
>>>> </soap:Envelope>
>>>>
>>>> AfterI enable the StaxTransformFeature , the clien received a soap message
>>>> like below:
>>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>>  <soap:Header/>
>>>>   <soap:Body>
>>>>     <ns2:subscribeServCfmResponse
>>>> xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common">
>>>>      <ns2:SubscribeServCfmResp>
>>>>       <result>0</result>
>>>>      </ns2:SubscribeServCfmResp>
>>>>    </ns2:subscribeServCfmResponse>
>>>>   </soap:Body>
>>>> </soap:Envelope>
>>>>
>>>
>>> It looks like a bug, at the moment the feature tries to avoid the
>>> 'left-over' prefixes leaking into the transformed representations (as often
>>> no traces of the 'old' namespace are expected), but in this case it breaks
>>> it.
>>>
>>> Can you have something like
>>>
>>>
>>> <map>
>>>      <entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>>> value="result" />
>>>      <entry
>>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse"
>>> value="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse"
>>> />
>>> </map>
>>>
>>> and check if it helps to retain this specific namespace ? If not then we
>>> will introduce a property for the namespace declarations be optionally
>>> retained
>>>
>>> Sergey
>>>
>>>>
>>>>
>>>>
>>>> cantalou89
>>>
>>>
>>>
>>> --
>>> Sergey Beryozkin
>>>
>>> Talend Community Coders
>>> http://coders.talend.com/
>>>
>>> Blog: http://sberyozkin.blogspot.com
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>

Re: StaxTransformFeature outTransformElements problem

Posted by Daniel Kulp <dk...@apache.org>.
On Oct 15, 2012, at 7:42 AM, Aki Yoshida <el...@gmail.com> wrote:

> I don't know why the ns2 prefix binding for those elements is removed.
> I'll look into it this afternoon.

Can you try with 2.6.3?  We did fix a couple of things related to dropped namespaces for 2.6.3:


commit 6993f39bccea4ed126debf88c8fdd842d00b4750
Author: Daniel Kulp <dk...@apache.org>
Date:   Fri Sep 28 15:48:52 2012 +0000

    Per javadoc, empty prefix needs to delgate to writeDefaultNamespace
    
    git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1391510 13f79535-47bb-0310-9956-ffa450edef68

commit 65aed4a841de14f1a7caec6fd1f0ebc28b79245b
Author: Akitoshi Yoshida <ay...@apache.org>
Date:   Thu Sep 13 15:17:46 2012 +0000

    [CXF-4503] TransformOutInterceptor may lose namespace declarations in some elements
    
    git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1384365 13f79535-47bb-0310-9956-ffa450edef68



Dan



> 
> 2012/10/15 Sergey Beryozkin <sb...@gmail.com>:
>> Hi
>> 
>> On 14/10/12 16:57, cantalou89 wrote:
>>> 
>>> Hi all,
>>> I encounter a problem when I used cxf 2.6.2 .
>>> I used StaxTransformFeature with configuration '<entry
>>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>>> value="result" />' to remove result element's namespace befor the soap
>>> message responsed to client. Althought the result element's namespace has
>>> removed , but the namespace description
>>> xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0
>>> of<ns2:subscribeServCfmResponse>  also has been removed, it is not what i
>>> want . I just want to replce<ns2:result>  of<result>  , so how could i do?
>>> Thanks .
>>> 
>>> The spring configuration below:
>>> <jaxws:endpoint id="UserOrderServer" address="/UserOrderServer.jws"
>>> implementor="com.funo.ehealth.ws.UserOrderServerImpl">
>>> 
>>>   <jaxws:outInterceptors>
>>>     <bean name="useForStaxTransformFeature"
>>> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"></bean>
>>>   </jaxws:outInterceptors>
>>> 
>>>   <jaxws:features>
>>>    <bean class="org.apache.cxf.feature.LoggingFeature" />
>>>    <bean id="transformFeature"
>>> class="org.apache.cxf.feature.StaxTransformFeature">
>>>      <property name="outTransformElements">
>>>        <map>
>>>         <entry
>>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>>> value="result" />
>>>        </map>
>>>      </property>
>>>     </bean>
>>>   </jaxws:features>
>>> </jaxws:endpoint>
>>> 
>>> Before I enable the StaxTransformFeature , the clien received a soap
>>> message like below:
>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>  <soap:Header/>
>>>   <soap:Body>
>>>     <ns2:subscribeServCfmResponse
>>> xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common"
>>> xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
>>>      <ns2:SubscribeServCfmResp>
>>>       <ns2:result>0</ns2:result>
>>>      </ns2:SubscribeServCfmResp>
>>>    </ns2:subscribeServCfmResponse>
>>>   </soap:Body>
>>> </soap:Envelope>
>>> 
>>> AfterI enable the StaxTransformFeature , the clien received a soap message
>>> like below:
>>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>>  <soap:Header/>
>>>   <soap:Body>
>>>     <ns2:subscribeServCfmResponse
>>> xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common">
>>>      <ns2:SubscribeServCfmResp>
>>>       <result>0</result>
>>>      </ns2:SubscribeServCfmResp>
>>>    </ns2:subscribeServCfmResponse>
>>>   </soap:Body>
>>> </soap:Envelope>
>>> 
>> 
>> It looks like a bug, at the moment the feature tries to avoid the
>> 'left-over' prefixes leaking into the transformed representations (as often
>> no traces of the 'old' namespace are expected), but in this case it breaks
>> it.
>> 
>> Can you have something like
>> 
>> 
>> <map>
>>      <entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>> value="result" />
>>      <entry
>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse"
>> value="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse"
>> />
>> </map>
>> 
>> and check if it helps to retain this specific namespace ? If not then we
>> will introduce a property for the namespace declarations be optionally
>> retained
>> 
>> Sergey
>> 
>>> 
>>> 
>>> 
>>> cantalou89
>> 
>> 
>> 
>> --
>> Sergey Beryozkin
>> 
>> Talend Community Coders
>> http://coders.talend.com/
>> 
>> Blog: http://sberyozkin.blogspot.com

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: StaxTransformFeature outTransformElements problem

Posted by Aki Yoshida <el...@gmail.com>.
I don't know why the ns2 prefix binding for those elements is removed.
I'll look into it this afternoon.

2012/10/15 Sergey Beryozkin <sb...@gmail.com>:
> Hi
>
> On 14/10/12 16:57, cantalou89 wrote:
>>
>> Hi all,
>> I encounter a problem when I used cxf 2.6.2 .
>> I used StaxTransformFeature with configuration '<entry
>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>> value="result" />' to remove result element's namespace befor the soap
>> message responsed to client. Althought the result element's namespace has
>> removed , but the namespace description
>> xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0
>> of<ns2:subscribeServCfmResponse>  also has been removed, it is not what i
>> want . I just want to replce<ns2:result>  of<result>  , so how could i do?
>> Thanks .
>>
>> The spring configuration below:
>> <jaxws:endpoint id="UserOrderServer" address="/UserOrderServer.jws"
>> implementor="com.funo.ehealth.ws.UserOrderServerImpl">
>>
>>    <jaxws:outInterceptors>
>>      <bean name="useForStaxTransformFeature"
>> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"></bean>
>>    </jaxws:outInterceptors>
>>
>>    <jaxws:features>
>>     <bean class="org.apache.cxf.feature.LoggingFeature" />
>>     <bean id="transformFeature"
>> class="org.apache.cxf.feature.StaxTransformFeature">
>>       <property name="outTransformElements">
>>         <map>
>>          <entry
>> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
>> value="result" />
>>         </map>
>>       </property>
>>      </bean>
>>    </jaxws:features>
>> </jaxws:endpoint>
>>
>> Before I enable the StaxTransformFeature , the clien received a soap
>> message like below:
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>   <soap:Header/>
>>    <soap:Body>
>>      <ns2:subscribeServCfmResponse
>> xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common"
>> xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
>>       <ns2:SubscribeServCfmResp>
>>        <ns2:result>0</ns2:result>
>>       </ns2:SubscribeServCfmResp>
>>     </ns2:subscribeServCfmResponse>
>>    </soap:Body>
>> </soap:Envelope>
>>
>> AfterI enable the StaxTransformFeature , the clien received a soap message
>> like below:
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>   <soap:Header/>
>>    <soap:Body>
>>      <ns2:subscribeServCfmResponse
>> xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common">
>>       <ns2:SubscribeServCfmResp>
>>        <result>0</result>
>>       </ns2:SubscribeServCfmResp>
>>     </ns2:subscribeServCfmResponse>
>>    </soap:Body>
>> </soap:Envelope>
>>
>
> It looks like a bug, at the moment the feature tries to avoid the
> 'left-over' prefixes leaking into the transformed representations (as often
> no traces of the 'old' namespace are expected), but in this case it breaks
> it.
>
> Can you have something like
>
>
> <map>
>       <entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result"
> value="result" />
>       <entry
> key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse"
> value="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse"
> />
> </map>
>
> and check if it helps to retain this specific namespace ? If not then we
> will introduce a property for the namespace declarations be optionally
> retained
>
> Sergey
>
>>
>>
>>
>> cantalou89
>
>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com

Re: StaxTransformFeature outTransformElements problem

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 14/10/12 16:57, cantalou89 wrote:
> Hi all,
> I encounter a problem when I used cxf 2.6.2 .
> I used StaxTransformFeature with configuration '<entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result" value="result" />' to remove result element's namespace befor the soap message responsed to client. Althought the result element's namespace has removed , but the namespace description xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0 of<ns2:subscribeServCfmResponse>  also has been removed, it is not what i want . I just want to replce<ns2:result>  of<result>  , so how could i do? Thanks .
>
> The spring configuration below:
> <jaxws:endpoint id="UserOrderServer" address="/UserOrderServer.jws" implementor="com.funo.ehealth.ws.UserOrderServerImpl">
>
>    <jaxws:outInterceptors>
>      <bean name="useForStaxTransformFeature" class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"></bean>
>    </jaxws:outInterceptors>
>
>    <jaxws:features>
>     <bean class="org.apache.cxf.feature.LoggingFeature" />
>     <bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature">
>       <property name="outTransformElements">
>         <map>
>          <entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result" value="result" />
>         </map>
>       </property>
>      </bean>
>    </jaxws:features>
> </jaxws:endpoint>
>
> Before I enable the StaxTransformFeature , the clien received a soap message like below:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Header/>
>    <soap:Body>
>      <ns2:subscribeServCfmResponse xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common" xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
>       <ns2:SubscribeServCfmResp>
>        <ns2:result>0</ns2:result>
>       </ns2:SubscribeServCfmResp>
>     </ns2:subscribeServCfmResponse>
>    </soap:Body>
> </soap:Envelope>
>
> AfterI enable the StaxTransformFeature , the clien received a soap message like below:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Header/>
>    <soap:Body>
>      <ns2:subscribeServCfmResponse xmlns="http://www.chinamobile.com/vgop/serviceorder/v1_0/common">
>       <ns2:SubscribeServCfmResp>
>        <result>0</result>
>       </ns2:SubscribeServCfmResp>
>     </ns2:subscribeServCfmResponse>
>    </soap:Body>
> </soap:Envelope>
>

It looks like a bug, at the moment the feature tries to avoid the 
'left-over' prefixes leaking into the transformed representations (as 
often no traces of the 'old' namespace are expected), but in this case 
it breaks it.

Can you have something like

<map>
       <entry 
key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}result" 
value="result" />
       <entry 
key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse" 
value="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResponse" 
/>
</map>

and check if it helps to retain this specific namespace ? If not then we 
will introduce a property for the namespace declarations be optionally 
retained

Sergey

>
>
>
> cantalou89


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com