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